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: SQL Tunning

Re: SQL Tunning

From: Daniel A. Morgan <dmorgan_at_exesolutions.com>
Date: Thu, 25 Jan 2001 21:52:30 -0800
Message-ID: <3A71109E.27DBB9DC@exesolutions.com>

I just tried it in Oracle 8.1.5.0.0 on a Windows NT box and got the following using SET TIMING ON.

SQL> select count(*)
  2 from airplanes;

 COUNT(*)


     1250

 real: 331
SQL> select count(1)
  2 from airplanes;

 COUNT(1)


     1250

 real: 30
SQL> It may not always be faster. But it certainly won't be slower.

Daniel A. Morgan

Niall Litchfield wrote:

> I don't believe that this last is true anymore.(as of 8i certainly but
> probably 8x).
>
> for example on on of our databases, after a couple of repetitions I get
>
> SQL> select count(1) from aglrelvalue;
>
> COUNT(1)
> ----------
> 2572566
>
> Elapsed: 00:00:01.42
> SQL> select count(*) from aglrelvalue;
>
> COUNT(*)
> ----------
> 2572566
>
> Elapsed: 00:00:01.42
>
> regards
>
> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK
> "Daniel A. Morgan" <dmorgan_at_exesolutions.com> wrote in message
> news:3A6FB5D2.FD584499_at_exesolutions.com...
> > > we're starting tunning for the provider application and we've a doubt.
> > > When a "select count(*) " sentence generally returns zero, how will be
> > > the performance over a large table?
> >
> > Could you please repeat your question with a bit more detail. I am having
> > a hard time understanding what you are asking.
> >
> > Also, generally select count(1) is faster than select count(*).
> >
> > Daniel A. Morgan
> >
Received on Thu Jan 25 2001 - 23:52:30 CST

Original text of this message

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