Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: count(*) vs count(columnX): Which one is better?
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.