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

Home -> Community -> Usenet -> c.d.o.server -> Re: Performance: Dates vs Varchar2

Re: Performance: Dates vs Varchar2

From: Mark J. Bobak <mark_at_bobak.net>
Date: Thu, 14 Feb 2002 02:38:04 GMT
Message-ID: <pan.2002.02.13.21.38.01.115078.6886@bobak.net>


If you're storing a date, put in a date datatype. If it's properly indexed, performance differences ought to be negligible.

-Mark
On Wed, 13 Feb 2002 11:08:38 -0500, Tom Barnes wrote:

> Lets say we store time/dates of certain events in a table and we want to
> select all events for a certain day. Which method will be faster
> (02/13/2002 is the in-parameter, can/should be replaced with bind
> variable)?
>
> 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')"
>
> B. Store the day of the event in a VARCHAR2(10) field, index this field,
> and have a where-clause like this: "where day = '02/13/2002'"
>
> It will be easier to compress the index in B but for this discussion,
> lets assume we don't use compression.
>
> Oracle 8.1.6.3 Enterprise Edition on Solaris
Received on Wed Feb 13 2002 - 20:38:04 CST

Original text of this message

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