![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, Can someone explain when the CBO takes into account the value of avg_row_len to estimate an access plan cost ? I suppose that the CBO uses this value to estimate the cost for a table scan, in combination with the number of blocks and the value of db_file_multiblock_read_count ? Thanks |
#3
| |||
| |||
|
|
On 9 Jul 2003 08:34:56 -0700, ydias (AT) hotmail (DOT) com (dias) wrote: Hi, Can someone explain when the CBO takes into account the value of avg_row_len to estimate an access plan cost ? I suppose that the CBO uses this value to estimate the cost for a table scan, in combination with the number of blocks and the value of db_file_multiblock_read_count ? Thanks It doesn't. It would also be unnecessary, as a block is a block is a block and a table scan is a table scan is a table scan. Oracle will always read a complete block. The number of blocks in use is taken into account. Sybrand Bakker, Senior Oracle DBA To reply remove -verwijderdit from my e-mail address |
#4
| |||
| |||
|
|
Thanks Sybrand, But why DBMS_STATS.GATHER_TABLE_STATS generates 3 statistics : num_rows, blocks and avg_row_len ? Dias Sybrand Bakker <gooiditweg (AT) sybrandb (DOT) demon.nl> wrote On 9 Jul 2003 08:34:56 -0700, ydias (AT) hotmail (DOT) com (dias) wrote: Hi, Can someone explain when the CBO takes into account the value of avg_row_len to estimate an access plan cost ? I suppose that the CBO uses this value to estimate the cost for a table scan, in combination with the number of blocks and the value of db_file_multiblock_read_count ? Thanks It doesn't. It would also be unnecessary, as a block is a block is a block and a table scan is a table scan is a table scan. Oracle will always read a complete block. The number of blocks in use is taken into account. Sybrand Bakker, Senior Oracle DBA To reply remove -verwijderdit from my e-mail address |
#5
| |||
| |||
|
|
ydias (AT) hotmail (DOT) com (dias) wrote in message news:<55a68b47.0307100208.30ffd38 (AT) posting (DOT) google.com>... Dias, Sybrand answered your statement on scanning. but in regards to your first question on when the avg_row_len statistic is used I would like to add a couple of comments. First, I am not sure when avg_row_len is used, but I believe that all statistics gathered by dbms_stats, unlike some of those gathered by the analyze commad (such as chained rows), are used by the CBO. The use may be indirect in that some statistics may be used in calculating other statistics that are directly used. For some reason I think the use of avg_row_len is in estimating logical IO, but I would not bank on that. |
|
For the average DBA it is probably much more important to know which statistics are important to the optimizer and to be able to recognize when they need recalculation than to know exactly how the CBO uses them. |
#6
| |||
| |||
|
|
First, I am not sure when avg_row_len is used, but I believe that all statistics gathered by dbms_stats, unlike some of those gathered by the analyze commad (such as chained rows), are used by the CBO. The use may be indirect in that some statistics may be used in calculating other statistics that are directly used. For some reason I think the use of avg_row_len is in estimating logical IO, but I would not bank on that. |
#7
| |||
| |||
|
|
Just a wild stab in the dark here... but if BLOCKS=400000 and avg_row_len=50 and num_rows=10, you can be pretty certain that most of those blocks under the high water mark are full of nothing but fresh air. Packed optimally, the table should only consume 500 bytes, which should comfortably fit into one block. The statistics are therefore screaming at you, "Inflated High Water Mark Syndrome!!" (ie, huge inserts, followed by massive deletes). If you asked me then to do a select * from table, I would ordinarily expect to do a full table scan, and never mind visiting the index. But with statistics like those, I suspect I'd rather access the table via the index. Indexes give you rowid access to the table data, and you don't have to wander through 399999 empty blocks to retrieve all 10 rows. So, yes: knowing your table is fluffier than a very fluffy soufflé is actually important to the optimizer, and avg_row_len is needed to tell it that. |
![]() |
| Thread Tools | |
| Display Modes | |
| |