oracle cost cardinality,ORACLE 执行计划中cost cardinality bytes cpu_cost io_cost解释
從網上找到的資料,加上我在文檔中查到的內容:
■ Cost The cost assigned to each step of the query plan by the CBO. The CBO works by
generating many different execution paths/plans for the same query and assigns a cost to
each and every one. The query plan with the lowest cost wins. In the full outer join example,
we can see the total cost for this query is 10.
■ Card Card is short for Cardinality. It is the estimated number of rows that will flow out
of a given query plan step. In the full outer join example, we can see the optimizer expects
there to be 327 rows in EMP and 4 rows in DEPT.
■ Bytes The size in bytes of the data the CBO expects each step of the plan to return.
This is dependent on the number of rows (Card) and the estimated width of the rows.
·Cardinality是指計劃中這一步所處理的行數,實際是一個估算值,不準確。
·cost指cbo中這一步所耗費的資源,這個值是相對值,和cpu_cost、io_cost是有關系的。
參考《Apress.Troubleshooting.Oracle.Perforamnce》,chapter 4 system and object statistics。
cpu_cost=column_position*20(this formular is used to compute the cpu cost of accessing a column)
cost是由其他幾個因素共同決定的,這里暫時不進行深入的研究。
一般情況下,在一張表只有一條記錄的情況下,cpu_cost會有個初始值(常見的是2萬多或3萬多),隨著記錄的增加,cpu_cost也成比例的增加。
對于io_cost來說,如果訪問的記錄在一個db_block中,值是不變的。
·bytes指cbo中這一步所處理所有記錄的字節數,是估算出來的一組值。
需要注意的是,在表記錄數變更后,如果不執行DBMS_STATS.gather_table_stats統計的話,得到的cost等指標是不變的,也就是不準確的,只有重新統計一下表后,才能正確反應耗費的成本。
一般的,造成速度問題的,大多是I/O問題引起的,降低磁盤IO,增加緩存效率,是優化的基本技術
總結
以上是生活随笔為你收集整理的oracle cost cardinality,ORACLE 执行计划中cost cardinality bytes cpu_cost io_cost解释的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php 匹配标记,php – 正则表达式
- 下一篇: Oracle大象,大象工程(石头剪刀布P