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: Why aren't these queries the same?

Re: Why aren't these queries the same?

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Sat, 09 Mar 2002 17:11:38 +0000
Message-ID: <3C8A424A.47F5@yahoo.com>


damorgan wrote:
>
> As long as you are looking to speed things up ... try replaeing count(*) with
> count(1) or count(rowid).
>
> Daniel Morgan
>
> Ed Stevens wrote:
>
> > I'm going through a process of identifying our biggest I/O hogs and working with
> > the devleopers to fix them. One statement has us stumped. The original looks
> > like this
> >
> > select count(*)
> > from scott.table_a
> > where (trunc(sysdate) - trunc(scott.table_a.mod_date) >= 12)
> > /
> >
> > so what they are looking for are instances of mod_date that are 12 or more days
> > old.
> >
> > We re-wrote the query to look like this
> >
> > select count(*)
> > from scott.table_a
> > where mod_date < (sysdate - 12)
> > /
> >
> > but they don't return the same results.
> >
> > I did confirm that trunc(sysdate) returned the same value as sysdate and
> > trunc(scott.table_a.mod_date) returned the same value as scott.table_a.mod_date.
> >
> > --
> > Ed Stevens
> > (Opinions expressed do not necessarily represent those of my employer.)

http://www.oracledba.co.uk/tips/count_speed.htm

will dispute that

-- 
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
Received on Sat Mar 09 2002 - 11:11:38 CST

Original text of this message

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