Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: count(*) vs count(columnX): Which one is better?

Re: count(*) vs count(columnX): Which one is better?

From: replace this with _at_ <_at_)xs4all.nl>
Date: Sun, 25 Oct 1998 12:19:40 GMT
Message-ID: <36321501.9130198@news.xs4all.nl>


Hi,

>Regarding an SQL statement like this:
> SELECT count(*) FROM tableX where columnX='ABC'
>and
> SELECT count(columnX) FROM tableX where columnX='ABC'
>
>Which one is better for performance?

Oracle recognizes count(*) and is not evaluating every column in the count. But, if columnX has an index and has a not null constraint, the index will be used.

>Would there be some differences in performance and efficiency?

There sure is.


Received on Sun Oct 25 1998 - 06:19:40 CST

Original text of this message

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