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 Tuning - How to avoid TOCHAR function against a date

RE: SQL Tuning - How to avoid TOCHAR function against a date

From: sundeep maini <sundeep_maini_at_yahoo.com>
Date: Tue, 09 Apr 2002 15:08:21 -0800
Message-ID: <F001.00440179.20020409150821@fatcity.com>


I am jumping in the middle of this thread so execuse me if I am repeating the past suggestions I haven't read yet. In a DW you'd have a date dim of dates only (no time component to date) and a time_dim (down to seconds). Your fact table should have a date_key and a time_key if both date and time components are significant. In that case your query

SELECT DATE_KEY
FROM DATE_DIM
WHERE TO_CHAR(ORACLE_DATE,'DD-MON-YYYY') = TO_CHAR(:b1,'DD-MON-YYYY')

would be transformed to:

SELECT DATE_KEY
FROM DATE_DIM
WHERE ORACLE_DATE = TRUNC(:b1);

You should perhaps update the oracle_date column in date_dim to TRUNC(oracle_date,'DD') and then rebuild the index on oracle_date column and run the above mentioned query.

Sundeep Maini
Consultant
Currently on Assignement at Marshfield Clinic WI mainis_at_mfldclin.edu



Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: sundeep maini
  INET: sundeep_maini_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Apr 09 2002 - 18:08:21 CDT

Original text of this message

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