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?
Robert Chung wrote:
>
> 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? What if columnX has an index?
> Would there be some differences in performance and efficiency? Thank
> you in advance.
These should be equivalent. However, if you changes the syntax as follows, you could get different counts provided columnX allows NULL values.
select count(*) from tableX; -- returns all rows select count(columnX) from tableX; -- returns rows with non-null -- columnX values.
In your example, though, the results SHOULD be identical.
-Bill Boyle Received on Sat Oct 24 1998 - 23:04:17 CDT