Database Tuning (MOSC)

MOSC Banner

Query on null values of a date field

edited Feb 4, 2010 1:44PM in Database Tuning (MOSC) 11 commentsAnswered ✓
 Hi

-

I am using a RAC database 10.2.0.4 and I have the next query:

SELECT * FROM JOSUE.CREDBURS_PAGOS CP WHERE CP.FECHA_PROCESO_PAGO IS NULL;

-

That one, takes 17 mins and performs a full table scan.

-

The field FECHA_PROCESO_PAGO is date type.

I have created the index "I_FECHA_PROCESO_PAGO" on the column filtered, like this:

NVL(FECHA_PROCESO_PAGO, TO_DATE('01/01/2000'))

-

Then I executed this query:

SELECT /*+INDEX (CP I_FECHA_PROCESO_PAGO) */ * FROM JOSUE.CREDBURS_PAGOS CP WHERE CP.FECHA_PROCESO_PAGO ='01/01/2000';

-

Now the explain plan shows it is taking the index, but the query takes much more than before.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center