开发者

What does Rows indicate in the explain plan?

This was my query:

SELECT payload_data FROM staging_record WHERE record_source = 11;

This was the execution plan:

------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name             | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |                  |  9016 |  1875K|   292   (1)| 00:00:05 |
|   1 |  TABLE ACCESS BY INDEX ROWID| STAGING_RECORD   |  9016 |  1875K|   292   (1)| 00:00:05 |开发者_StackOverflow中文版
|*  2 |   INDEX RANGE SCAN          | IX_RECORD_SOURCE |  9016 |       |    15   (0)| 00:00:01 |
------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("RECORD_SOURCE"=11)

I did a count and it returned 22619 with this query

SELECT COUNT(*) FROM staging_record WHERE record_source = 11;

Why does Rows column say 9016 when my count returned 22619. What is Rows refering to here?


The figure of 9016 is the optimizer's estimate based on the statistics it has. If the table has 901,600 rows and there are 100 distinct values for record_source, then the optimizer may estimate that a typical query by record_source will return 901,600/100 = 9016 rows. Skewing of the actual data may make this innacurate (it will never be perfect). If the data is quite skewed then histograms can be used to refine the statistics further.


Your indicies are obsolete. Refresh stats (using DBMS_STATS) and you'll get more accurate value.

Rows refers to the amount of rows being affected during query execution (approximate, according to the indicies info).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜