Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Would Oracle use index on count(*)?
What if the primary key of the table you are working with has a compound
primary key? Is there such a thing as count(col1, col2, col3), where col1,
col2 and col3 make up a compound primary key?
Also, the discussion on using count(column) to force using the primary key also applies to ANY index, true?
--
Regards,
Jim
Jonathan Lewis wrote in message <01bd67a7$5b5c31d0$294b989e_at_WORKSTATION>...
>
>
>
>Eugen Nyffeler <eugen.nyffeler_at_ubs.com> wrote in article
><35331BA9.86E49A6E_at_ubs.com>...
>>
>> If you use a count(*) the full table scan is coosen. If you use
>> count(primary key field)
>> an index scan shoud be used. I don't know the exact Oracle
>internals for
>> this, but
>> i think one reason is to make the codeing simple (e.g. what do you
>do
>> when there
>> are several indexes but none is unique, or even indexes with null
>value
>> ??)
>>
>
Received on Tue Apr 14 1998 - 08:48:17 CDT
![]() |
![]() |