Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL Tunning
You can also create a function based index on TRUNC(last_update_date), but
w/o any changes to your tables and/or indexes rephrasing the query to
WHERE last_update_date BETWEEN TRUNC(SYSDATE - 1) AND TRUNC(SYSDATE -
1/86400)
will make an index-range scan possible. The 1/86400 is to subtract 1
second of the SYSDATE, to prevent including the 0:00:00 updates of today.
Regards, Carel-Jan
===
If you think education is expensive, try ignorance. (Derek Bok)
===
> Hello expert,
>
> I have a table with 40 millions records and the last update date is
> indexed. But when we use the
> following where clause, it takes forever to run the report.
>
> WHERE TRUNC(last_update_date) = TRUNC(SYSDATE - 1)
>
> How to improve the performance? Do I need to create a new index field on
> the table with TRUNC(last_update_date)?
> ----------------------------------------------------------------
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> ----------------------------------------------------------------
> To unsubscribe send email to: oracle-l-request_at_freelists.org
> put 'unsubscribe' in the subject line.
> --
> Archives are at http://www.freelists.org/archives/oracle-l/
> FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------
>
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Mon Aug 02 2004 - 05:21:47 CDT
![]() |
![]() |