How do NULL values affect performance in a database search?

In Oracle, NULL values are not indexed, i. e. this query:

SELECT  *
FROM    table
WHERE   column IS NULL

will always use full table scan since index doesn’t cover the values you need.

More than that, this query:

SELECT  column
FROM    table
ORDER BY
        column

will also use full table scan and sort for same reason.

If your values don’t intrinsically allow NULL‘s, then mark the column as NOT NULL.

Leave a Comment