Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL Tunning

Re: SQL Tunning

From: Carel-Jan Engel <cjpengel.dbalert_at_xs4all.nl>
Date: Mon, 2 Aug 2004 12:25:52 +0200 (CEST)
Message-ID: <16538.145.61.28.21.1091442352.squirrel@webmail.xs4all.nl>


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
> -----------------------------------------------------------------
>



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
-----------------------------------------------------------------
Received on Mon Aug 02 2004 - 05:21:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US