Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Performance: Dates vs Varchar2
On 13 Feb 2002 08:08:38 -0800, barnest_at_san.rr.com (Tom Barnes) wrote:
>A. Store the event time/date in a DATE field, index this field, and
>have a where-clause like this:
>"where eventTime between to_date('02/13/2002','MM/DD/YYYY') and
>to_date('02/13/2002 23:59:59','MM/DD/YYYY HH24:MI:SS')"
Why not use WHERE TRUNC(eventTime) = to_date(...)? That cuts the number of possibilities down to a reasonable number and avoids < and > operations. You could store TRUNC(eventTime) in its own column, or build a function-based index on the result of TRUNC(eventTime) for each row.
John
-- Got an Oracle database question? Try the search engine for the database docs at: http://tahiti.oracle.com/Received on Thu Feb 14 2002 - 03:28:05 CST