Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: count(*) v. count(pk)
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
![]() |
![]() |