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: What to Count - WAS Re: Newbie ? - Howto find nbr records in a table

Re: What to Count - WAS Re: Newbie ? - Howto find nbr records in a table

From: replace this with _at_ <_at_)xs4all.nl>
Date: Wed, 07 Oct 1998 21:24:23 GMT
Message-ID: <361bdb16.1049308@news.xs4all.nl>


Hi,

>This raises a question for me. The use of COUNT(*) that is. A few years
>ago, in my early days of Oracle, a chap with more experience than I
>explained that he always used COUNT(9) as opposed to COUNT(*) when doing
>this sort of thing. Obviously, it makes absolutley no difference to the
>answer.

It does. The optimizer will recognize the '*' and react to it by NOT retrieving all data records. But, count(primary_key_field) will be even better, because that will only access the index. No data from the table has to be retrieved. So use count(pk-field) whenever you can.


Received on Wed Oct 07 1998 - 16:24:23 CDT

Original text of this message

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