Re: Performance off "count(*)"

  • From: "Jonathan Lewis" <jonathan@xxxxxxxxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Sat, 19 Jul 2008 09:25:48 +0100


Tanel,

I think it might be possible to:
check the clean SCN
check the transaction count
check that all transactions are committed
and deduce from this whether or not it was okay
to count the number of rows in the block from the "row index" area, excluding null pointers.

For blocks with a large enough number of rows this might be more efficient than walking the row lengths.


Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com

Author: Cost Based Oracle: Fundamentals
http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html


----- Original Message ----- From: "Tanel Poder" <tanel.poder.003@xxxxxxx>
To: <greg@xxxxxxxxxxxxxxxxxx>; <Marco.Gralike@xxxxxxx>
Cc: <oracle-l@xxxxxxxxxxxxx>
Sent: Saturday, July 19, 2008 7:53 AM
Subject: 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


--
//www.freelists.org/webpage/oracle-l


Other related posts: