统计分析中extended statistics的作用
2013-03-14 13:51
197 查看
Oracle Database can also gather statistics on a group of columns within a table or an expression on a column sh@ORCL> exec dbms_stats.gather_table_stats(user,'CUSTOMERS'); PL/SQL 过程已成功完成。 sh@ORCL> set autotrace on exp; --此时没有进行extended statistics分析,执行计划估算行数与实际相差很大 sh@ORCL> SELECT COUNT(*) 2 FROM customers 3 WHERE cust_state_province = 'CA' 4 AND country_id=52790; COUNT(*) ---------- 3341 执行计划 ---------------------------------------------------------- Plan hash value: 296924608 -------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 16 | 406 (1)| 00:00:05 | | 1 | SORT AGGREGATE | | 1 | 16 | | | |* 2 | TABLE ACCESS FULL| CUSTOMERS | 1256 | 20096 | 406 (1)| 00:00:05 | -------------------------------------------------------------------------------- sh@ORCL> SELECT COUNT(*) 2 FROM sh.customers 3 WHERE cust_state_province = 'CA'; COUNT(*) ---------- 3341 执行计划 ---------------------------------------------------------- Plan hash value: 296924608 -------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 11 | 406 (1)| 00:00:05 | | 1 | SORT AGGREGATE | | 1 | 11 | | | |* 2 | TABLE ACCESS FULL| CUSTOMERS | 3631 | 39941 | 406 (1)| 00:00:05 | -------------------------------------------------------------------------------- sh@ORCL> call DBMS_STATS.GATHER_TABLE_STATS('SH','CUSTOMERS',METHOD_OPT => 'FOR ALL COLUMNS SIZE SKEWONLY FOR COLUMNS(CUST_STATE_PROVINCE,COUNTRY_ID) SIZE SKEWONLY'); 调用完成。 --进行extended statistics分析后,执行计划估算与实际相差很小 sh@ORCL> SELECT COUNT(*) 2 FROM customers 3 WHERE cust_state_province = 'CA' 4 AND country_id=52790; COUNT(*) ---------- 3341 执行计划 ---------------------------------------------------------- Plan hash value: 296924608 -------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 16 | 406 (1)| 00:00:05 | | 1 | SORT AGGREGATE | | 1 | 16 | | | |* 2 | TABLE ACCESS FULL| CUSTOMERS | 3331 | 53296 | 406 (1)| 00:00:05 | --------------------------------------------------------------------------------
相关文章推荐
- [一起学Hive]之十五-分析Hive表和分区的统计信息(Statistics)
- 统计分析工具的作用
- 统计分析中常用的函数与作用
- Topographic ICA as a Model of Natural Image Statistics(作为自然图像统计模型的拓扑独立成分分析)
- Topographic ICA as a Model of Natural Image Statistics(作为自然图像统计模型的拓扑独立成分分析)
- 统计分析模块statistics
- 分析Hive表和分区的统计信息(Statistics)
- [一起学Hive]之十五-分析Hive表和分区的统计信息(Statistics)
- MobclickAgent 友盟统计分析工具
- [总结] Oracle表的分析统计
- 深入分析request_irq的dev_id参数作用
- 话说WAYOS中所谓利用IP VLAN来实现用户隔离的作用分析
- 统计分析基础-描述数据
- python数据分析2:双色球 蓝红球分析统计
- 我的Android进阶之旅------>Android Studio使用statistics插件统计项目代码总行数
- PHP源代码数组统计count分析
- 索骥馆-OFFICE系列之《北风网Excel高端应用培训:多条件约束报表自动统计系统分析与制作》共4章更新完
- SET STATISTICS IO和SET STATISTICS TIME 在SQL Server查询性能优化中的作用
- Java web 实现 之 Filter分析ip统计网站的访问次数
- 卖家网eBay数据分析工具-专业免费的eBay开店数据统计-eBay销售分析-eBay卖家分析工具软件