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: Select count(*) in Oracle and MySQL

Re: Select count(*) in Oracle and MySQL

From: Mladen Gogala <mgogala_at_yahoo.com>
Date: 09 Oct 2007 16:13:18 GMT
Message-ID: <470ba89d$0$1348$834e42db@reader.greatnowhere.com>


On Tue, 09 Oct 2007 08:35:09 -0700, fitzjarrell_at_cox.net wrote:

> Same elapsed time, fewer recursive calls for select count(*). I don't
> see the 'benefit' of using 'select count(rowid)'.

Sometimes even going through the primary key isn't the fastest way:

SQL> select /*+ index_ffs(no,PK_NI_OCCURRENCE_ID) */   2 count(*) from ni_occurrence no;

  COUNT(*)



 285395625

Elapsed: 00:04:45.22
SQL> select count(*) from ni_occurrence;

  COUNT(*)



 285396154

Elapsed: 00:01:17.65
SQL> (There was another, index, smaller then the primary key, that could be used for this).

-- 
http://www.mladen-gogala.com
Received on Tue Oct 09 2007 - 11:13:18 CDT

Original text of this message

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