RE: Performance off "count(*)"
Date: Sun, 20 Jul 2008 10:00:07 +0200
Message-ID: <F2C9CCA71510B442AF71446CAE8AEBAF0117E5B0@MSXVS04.trivadis.com>
Hi
FWIW I'm with Tanel on this one ;-)
Both, the number of rows stored in the "data header" and in the "table directory" contain deleted rows and one "row" for each rowpiece. In addition, when compression or clusters are used, additional "rows" are available for the structures needed to support them.
As a result, the only way to get the number of rows is to read the "row header" of the table on which the count must be performed. Therefore, IMO and according to my tests, the only optimization of the count(*) is to be able to access the row header only. In other words, to completely skip row data. In my book, in chapter 12, there is a figure that shows that effect.
Cheers,
Chris
Troubleshooting Oracle Performance, Apress 2008 http://top.antognini.ch
-- http://www.freelists.org/webpage/oracle-lReceived on Sun Jul 20 2008 - 03:00:07 CDT