Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Would Oracle use index on count(*)?
Jim Morgan wrote:
>
> I saw this thread late, but I ran into this once before and was wondering
> why count(*) took so long. I tried count(colname) but that performed just
> as poorly. It kind of makes sense that count(primarykey) would use the
> index and thus perform much better, but what if you had a compound primary
> key?
>
> Is there such a thing as count(col1, col2, col3) where col1, col2 and col3
> make up a composite primary key?
>
> Also, I imagine the discussion of count(column) using an index holds true
> whether you're talking about a primary key or ANY index. True?
>
> --
> Regards,
> Jim
If the 1st count field is the major part of the index, I wouldn't
think that you would need to specify the remainder of the composite
key. The optimizer should still process using the index. If you
used the minor part then no, unless there is another index on that
part.
Received on Tue Apr 14 1998 - 21:35:19 CDT
![]() |
![]() |