RE: Performance off "count(*)"

  • From: "Marco Gralike" <Marco.Gralike@xxxxxxx>
  • To: "Tanel Poder" <tanel.poder.003@xxxxxxx>, <greg@xxxxxxxxxxxxxxxxxx>
  • Date: Sat, 19 Jul 2008 10:42:13 +0200

If there is something like "an optimized method" for "count(*)" based on the 
internals, wouldn't it be more cost effective to determine it based on the 
freelist info...

________________________________

Van: Tanel Poder [mailto:tanel.poder.003@xxxxxxx]
Verzonden: za 19-7-2008 8:53
Aan: greg@xxxxxxxxxxxxxxxxxx; Marco Gralike
CC: oracle-l@xxxxxxxxxxxxx
Onderwerp: RE: Performance off "count(*)"



Hi Greg,

As far as I know the "nrow" in block header stores number of all row
structures in a block, including deleted rows (with delete flag set in row
header) and continued row pieces (chained rows) so Oracle still has to go to
individual row header to determine whether to count it or not...

--
Regards,
Tanel Poder
http://blog.tanelpoder.com <http://blog.tanelpoder.com/> 


> -----Original Message-----
> From: oracle-l-bounce@xxxxxxxxxxxxx
> [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Greg Rahn
> Sent: Saturday, July 19, 2008 05:44
> To: Marco.Gralike@xxxxxxx
> Cc: oracle-l@xxxxxxxxxxxxx
> Subject: Re: Performance off "count(*)"
>
> On Fri, Jul 18, 2008 at 10:28 AM, Marco Gralike
> <Marco.Gralike@xxxxxxx> wrote:
> >
> > Am I correct in my "small understanding" of Oracle that
> "count(*)" has
> > been optimized.
>
> A count(*) that uses TABLE ACCESS FULL access does not have
> to read each block in its entirety, it just reads the header
> to see how many rows are in the block.  I guess you could
> call that "optimized".
>
>
> --
> Regards,
> Greg Rahn
> http://structureddata.org <http://structureddata.org/> 
> --
> //www.freelists.org/webpage/oracle-l
>
>



Other related posts: