執行計劃中Cardinality (Estimated Rows, E-Rows) 估算錯誤原因分析
http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/
1. Data skew : NDV (Number of distinct values) inaccurate due to data skew and a poor dbms_stats sample?
Data correlation: Are two or more predicates related to each other?
Out-of-range values: Is the predicate within the range of known values?
Use of functions in predicates: Is the 5% cardinality guess for functions accurate?
Stats gathering strategies: Is your stats gathering strategy yielding representative stats?
Some possible solutions to these issues are:
Data skew (資料傾斜): 選擇一個sample size得出正確的 NDV (Number of distinct values). 11g中使用DBMS_STATS.AUTO_SAMPLE_SIZE
直方圖也是一個選項 。
Data correlation (資料相關): 當謂詞使用多個相關列(correlated column)時,會導致約束條件的冗餘。這幾個相關的列也被稱作關聯列。
出現這種情況時,查詢最佳化器也可能會做出不準確的判斷,在11g中可以使用 Extended Stats收集基於表示式或者一組列上
的物件統計資訊和直方圖,從而解決這種問題. 如果版本<= 10.2.0.3 可以使用 CARDINALITY hint .
Out-of-range values: 謂詞在所知值的範圍之外,需要收集或手工設定statistics。
Use of functions in predicates: 謂詞中使用函式。在可能的地方使用 CARDINALITY hint 。
Stats gathering strategies: 資料收集策略是否產生具有代表性的統計資訊。嘗試使用AUTO_SAMPLE_SIZE. Adjust only where necessary.
Be mindful of tables with skewed data.
1. Data skew : NDV (Number of distinct values) inaccurate due to data skew and a poor dbms_stats sample?
Data correlation: Are two or more predicates related to each other?
Out-of-range values: Is the predicate within the range of known values?
Use of functions in predicates: Is the 5% cardinality guess for functions accurate?
Stats gathering strategies: Is your stats gathering strategy yielding representative stats?
Some possible solutions to these issues are:
Data skew (資料傾斜): 選擇一個sample size得出正確的 NDV (Number of distinct values). 11g中使用DBMS_STATS.AUTO_SAMPLE_SIZE
直方圖也是一個選項 。
Data correlation (資料相關): 當謂詞使用多個相關列(correlated column)時,會導致約束條件的冗餘。這幾個相關的列也被稱作關聯列。
出現這種情況時,查詢最佳化器也可能會做出不準確的判斷,在11g中可以使用 Extended Stats收集基於表示式或者一組列上
的物件統計資訊和直方圖,從而解決這種問題. 如果版本<= 10.2.0.3 可以使用 CARDINALITY hint .
Out-of-range values: 謂詞在所知值的範圍之外,需要收集或手工設定statistics。
Use of functions in predicates: 謂詞中使用函式。在可能的地方使用 CARDINALITY hint 。
Stats gathering strategies: 資料收集策略是否產生具有代表性的統計資訊。嘗試使用AUTO_SAMPLE_SIZE. Adjust only where necessary.
Be mindful of tables with skewed data.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-1383468/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 動態建立 @ViewChild 導致執行時錯誤的原因分析View
- (4) MySQL中EXPLAIN執行計劃分析MySqlAI
- 檢視執行計劃出現ORA-22992錯誤
- explain執行計劃分析AI
- 分析執行計劃優化SQLORACLE的執行計劃(轉)優化SQLOracle
- SqlServer的執行計劃如何分析?SQLServer
- DB2執行計劃分析DB2
- 執行錯誤集
- 執行計劃-1:獲取執行計劃
- mysql 執行計劃索引分析筆記MySql索引筆記
- 執行指令碼寫入中間表錯誤返回錯誤資訊指令碼
- 詳細分析 Java 中啟動執行緒的正確和錯誤方式Java執行緒
- ORA-32701錯誤原因分析及處理方法
- SQLSERVER中得到執行計劃的方式SQLServer
- MySQL——通過EXPLAIN分析SQL的執行計劃MySqlAI
- MySQL執行計劃MySql
- SYBASE執行計劃
- MySQL 執行計劃MySql
- PbootCMS錯誤提示:執行SQL發生錯誤!錯誤:no such column: def1bootSQL
- 【執行計劃】Oracle獲取執行計劃的幾種方法Oracle
- 執行SQL發生錯誤!錯誤:disk I/O errorSQLError
- MySQL在刪除表時I/O錯誤原因分析MySql
- PbootCMS執行SQL發生錯誤!錯誤:no such column: def1bootSQL
- PbootCMS 執行SQL發生錯誤!錯誤: no such table:ay_configbootSQL
- MySQL執行計劃解析MySql
- mysql explain 執行計劃MySqlAI
- mysql執行計劃explainMySqlAI
- oracle 固定執行計劃Oracle
- Oracle sql執行計劃OracleSQL
- 執行計劃執行步驟原則
- 【PG執行計劃】Postgresql資料庫執行計劃統計資訊簡述SQL資料庫
- MySql中執行計劃如何來的——Optimizer TraceMySql
- mongodb執行計劃解釋MongoDB
- 檢視 OceanBase 執行計劃
- MySQL執行計劃解析(四)MySql
- 讀懂MySQL執行計劃MySql
- Explain執行計劃詳解AI
- PostgreSQL執行計劃變化SQL
- explain 查詢執行計劃AI