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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Index and functions

Re: Index and functions

From: Tomm Carr <carr%tw_at_edwards.af.mil>
Date: 1997/08/19
Message-ID: <33FA3F54.7A76@edwards.af.mil>#1/1

Roger Wernersson wrote:
>
> I seem have a problem. I have a table with one number per hour
> and I want to get the sum of these per day, month, quarter and
> year. I created a view using "TRUNC (my_date, my_mask)" using
> another table with rows for each valid mask.
>
> The problem is that it is so slow. Is a selection based on this
> view using the index of the my_date-column even though I am using
> a function?

You should post the entire select statement so we can see how you are using the trunc call. For instance, if the where clause looks like this:

  select ...
  where the_date = trunc( my_date, my_mask );

then the call to trunc is made for every row examined. However, if you change it to

  select ...
  where the_date in (select trunc(my_date, my_mask) from dual);

then the call to trunc is made only once for the entire statement. Something like that could explain at least part of a slow response.

-- 
Tomm Carr
---- ----
Hunting for a job is like hunting for an elephant.
If you're not *very* careful, you might find one!
Received on Tue Aug 19 1997 - 00:00:00 CDT

Original text of this message

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