Myth: Oracle Cannot Index NULL


The source of this myth is rather easy to understand when you look at the correctly expressed statement:

The Oracle database does not include rows into an index if all indexed columns are NULL.

The difference between the myth and the reality is small—it seems that the myth is a sloppy form of the truth.

The truth is that NULL can be indexed by adding another not nullable column to the index:

CREATE INDEX with_null ON table_name (nullable_column, '1');

Read Section 6.1 for the full story.

About the Author

As an author, trainer, and coach Markus Winand specializes in helping developers cope with SQL performance issues. He also published the book SQL Performance Explained and tweets his best performance tips via @SQLPerfTips.http://winand.at/

Recent Questions at Ask.Use-The-Index-Luke.com

0
votes
1
answer
52
views

We want to buy the book but I can't

Jul 18 at 21:36 Markus Winand ♦♦ 541
book
0
votes
2
answers
111
views
0
votes
0
answers
750
views

Performance very bad in Postgresql 9.3

Jul 08 at 11:54 Markus Winand ♦♦ 541
performance issue