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: count(*) v. count(pk)

Re: count(*) v. count(pk)

From: Matthias Gresz <GreMa_at_t-online.de>
Date: 28 Apr 1998 08:24:53 GMT
Message-ID: <6i43ol$jec$2@news00.btx.dtag.de>


Venkat schrieb:
>
> >1) Is this in fact true (that a count(*) always does a full table scan)?
> **** Yes count(*) always does a FTS

No, using CBO might lead to an index scan. That's propably why Brendan's testing resulted in same performance.

>
> >2) Isn't counting on the primary key an impossibility if the key is
> comprised
> >of multiple columns?
>
> **** No. You can do SELECT COUNT(ename||empno) from emp;
>
> >3) Can anyone suggest any other method for quickly retieving total rows
> from
> >large, multi-column-PK tables?
>
> **** If you keep your statistics upto-date a simple solution would be query
> the dba_tables to see the number of rows. Analyze your tables and then
> query the num_rows column of dba_tables.
>
> HTH
> Venkat

--

Regards

Matthias Gresz :-)

GreMa_at_t-online.de Received on Tue Apr 28 1998 - 03:24:53 CDT

Original text of this message

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