Oracle DBMS_STATS 包 和 Analyze 命令的區別
當某 個索引處於monitoring usage的時候,如果使用dbms_stats去分析表並且同時分析索引,會將該索引的v$object_usage.USED 設定為TRUE,導致監控了N天的可疑索引前功近棄。如果使用analyze,索引的狀態不會被設定為USE = TRUE
DBMS_STATS僅僅收集對CBO有用的統計資訊,所以一些空間使用情況資訊和使用FreeList管理的資訊都不會被收集,這些資訊包括:
If statistics unrelated to the cost basedoptimizer are required, then these must still be collected using the theANALYZE command. These statistics include:
Space Usage information :
EMPTY_BLOCKS,
AVG_SPACE,
CHAIN_CNT
Information on freelistblocks
AVG_SPACE_FREELIST_BLOCKS,NUM_FREELIST_BLOCKS
因為以上資訊對於CBO計算成本並沒有幫助,所以DBMS_STATS也就無意也無法收集它們,但是Analyze命令還是可以做到收集以上這些資訊。
此 外因為CBO其實並不會參考Cluster型別物件的統計資訊來計算Cost成本,而是使用cluster中各個表的統計資訊(DBMS_STATS does not gathercluster statistics, but you can use DBMS_STATS to gather statistics on theindividual tables instead of the whole cluster. )
所以DBMS_STATS也不支援收集Cluster的統計資訊。
Oracle公司已經明確了Analyze作為”validate”驗證命令的功能定位,且很多內部的工具和指令碼仍在使用AnalyzeTable/Cluster/Index的特有功能,所以可以預期Analyze命令在未來的一段時間內也不會被廢棄。
(1)Analyze validate structure 驗證表、簇、索引的結構的完整性,使用cascade選項可以交叉驗證表和索引的資料完整,online選項可以做到線上驗證
(2)Analyze list chained rows 收集表、簇上的Migrated and Chained Rows鏈式或遷移行資訊
(3)Analyze table compute statistics 收集表上的 empty_blocks、avg_space 空間使用資訊
(4)Analyze Cluster 收集簇的資訊,其實cluster上唯一可統計的資訊是DBA_CLUSTERS.AVG_BLOCKS_PER_KEY(Numberof blocks in the table divided by number of cluster keys) , 所以收集cluster的statistics意義不大
1.對於分割槽表,建議使用DBMS_STATS,而不是使用Analyze語句。
(1)可以並行進行,對多個使用者,多個Table
(2)可以得到整個分割槽表的資料和單個分割槽的資料。
(3)可以在不同級別上ComputeStatistics:單個分割槽,子分割槽,全表,所有分割槽。
(4)可以倒出統計資訊
(5)可以使用者自動收集統計資訊
2. DBMS_STATS的缺點
(1)不能Validate Structure
(2)不能收集CHAINEDROWS, 不能收集CLUSTERTABLE的資訊,這兩個仍舊需要使用Analyze語句。
(3)DBMS_STATS 預設不對索引進行Analyze,因為預設Cascade是False,需要手工指定為True
3. 對於oracle 9裡面的External Table,Analyze不能使用,只能使用DBMS_STATS來收集資訊.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29337971/viewspace-1871424/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用 nuxi analyze 命令分析 Nuxt 應用的生產包UX
- MySQL和Oracle的區別MySqlOracle
- Oracle和MySQL的區別OracleMySql
- 原始碼包和rpm包的區別原始碼
- source 和export 命令的區別Export
- linuxsu和sudo命令的區別Linux
- Analyze table對Oracle效能的提升Oracle
- Oracle中Date和Timestamp的區別Oracle
- Oracle dba角色和sysdba的區別Oracle
- oracle中distinct和group by的區別Oracle
- Oracle 和 mysql的9點區別OracleMySql
- jar包和war包的介紹與區別JAR
- Linux 命令 su 和 sudo 的區別Linux
- jar包、war包和ear包的介紹與區別JAR
- 高仿包和1:1包區別
- mac 的tar命令--exclude和linux的tar命令--exclude的區別MacLinux
- dg和ogg的區別--oracle資料庫Oracle資料庫
- NULL在oracle和mysql索引上的區別NullOracleMySql索引
- Linux中rmdir和rm命令的主要區別!Linux
- 【linux】free命令中cached和buffers的區別Linux
- 深度解析!Linux 命令 su 和 sudo 的區別Linux
- Linux free 命令中cached 和 buffers 的區別Linux
- gucci高仿包和正品區別?
- oracle知識整理(1) union和union all的區別,left join和right join的區別(各種join的區別)Oracle
- Redis中KEYS和SCAN命令的區別和建議Redis
- Oracle普通檢視和物化檢視的區別Oracle
- 資料包分析中Drop和iDrop的區別
- 正品包和高仿包有什麼區別嗎
- Git merge和rebase分支合併命令的區別Git
- Git常用命令,merge和rebase的區別Git
- Linux中less和more命令的區別有哪些?Linux
- mysql與Oracle的區別MySqlOracle
- [20210506]oracle19c dbms_stats的預設引數.txtOracle
- 命令和事件有什麼區別? - Oskar事件
- 淺析Oracle(rownum)和Mysql(limit)分頁的區別OracleMySqlMIT
- Oracle中單引號和雙引號的區別Oracle
- Flink - 安裝包scala 2.12和scala 2.11的區別
- subprocess中命令為引數序列和字串的區別字串
- SpringBoot的repackage和Maven打包命令之間的區別 - BaeldungSpring BootPackageMaven