Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Would Oracle use index on count(*)?
You can do select count(col1||col2||col3) from tablename (concatenate the
columns together into one column or you'll get an error about too many
arguments).
The table I used wasn't large enough to reliably tell if using a unique or
non-unique index would make a difference, though.
--
Matt Brennan
SQL*Tools Specialist
GERS Retail Systems
9725-C Scranton Road
San Diego, California 92121
1-800-854-2263
mbrennan_at_gers.com
Jim Morgan <jimmorgan_at_csi.com> wrote in article
<6gvp53$ts2$1_at_rtpnews.raleigh.ibm.com>...
> 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
>
>
>
>
Received on Tue Apr 14 1998 - 17:20:25 CDT