Pages

Wednesday, March 31, 2010

Avoid queries with condition IS NULL

Avoid queries with condition IS NULL
( Rather create column with NOT NULL Default value).
If IS NULL is required, consider replacing it with a NVL call
and a function based index, while this may not help with outer joins,
it will help with IS NULL type selects.


select count(*) from test where object_id is null;

( TABLE ACCESS (FULL))

select count(*) from test where nvl(object_id,-1)=-1;

- INDEX (RANGE SCAN) OF 'FBI_TEST' (NON-UNIQUE)"

No comments:

Post a Comment