Re: is it possible in pl/sql?

  • From: Mark Bole <makbo@xxxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 15 Feb 2005 09:32:18 -0800

Looney, Jason wrote:

> My understanding was in the past count(*) returned a count of all non-null
> rows, where count(1) (or any constant) returned a count of all rows.  I just
> verified this with 10g and this is not the case.  The performance difference
> was to perform a full table scan, instead of counting leaf blocks in a
> primary key index or something like that.  So maybe this was true in 6 or 7?

For what it's worth, my recollection is the same, except I think it was 
the other way around -- count('x') (based on unique index) would return 
only non-nulls, because of the way regular indexes handle nulls, while 
count(*) (full table scan) would return all rows.

I couldn't quickly reproduce the behavior in 10g either, and didn't 
bother with an older version.

Mark Bole


Other related posts: