DISTINCT 列添加索引
2016-04-15 18:03
483 查看
添加索引后,没啥效要,这方面优化没啥效果,如果项目要用到DISTINCT进行去重,需要再去确认基表关联,确认业务。 SQL> select t.object_id from t_distinct_tb t ; 已选择50631行。 已用时间: 00: 00: 00.71 执行计划 ---------------------------------------------------------- Plan hash value: 1512865825 ----------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ----------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 50086 | 635K| 161 (2)| 00:00:02 | | 1 | TABLE ACCESS FULL| T_DISTINCT_TB | 50086 | 635K| 161 (2)| 00:00:02 | ----------------------------------------------------------------------------------- Note ----- - dynamic sampling used for this statement 统计信息 ---------------------------------------------------------- 50 recursive calls 0 db block gets 4109 consistent gets 696 physical reads 0 redo size 732835 bytes sent via SQL*Net to client 37510 bytes received via SQL*Net from client 3377 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 50631 rows processed SQL> select distinct t.object_id from t_distinct_tb t ; 已选择50631行。 已用时间: 00: 00: 00.56 执行计划 ---------------------------------------------------------- Plan hash value: 3170339755 -------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | -------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 50086 | 635K| | 406 (3)| 00:00:05 | | 1 | HASH UNIQUE | | 50086 | 635K| 1976K| 406 (3)| 00:00:05 | | 2 | TABLE ACCESS FULL| T_DISTINCT_TB | 50086 | 635K| | 161 (2)| 00:00:02 | -------------------------------------------------------------------------------------------- Note ----- - dynamic sampling used for this statement 统计信息 ---------------------------------------------------------- 4 recursive calls 0 db block gets 767 consistent gets 0 physical reads 0 redo size 732835 bytes sent via SQL*Net to client 37510 bytes received via SQL*Net from client 3377 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 50631 rows processed SQL> SQL> select distinct t.object_id from t_distinct_tb t ; 已选择50631行。 已用时间: 00: 00: 00.51 执行计划 ---------------------------------------------------------- Plan hash value: 3170339755 -------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | -------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 50086 | 635K| | 406 (3)| 00:00:05 | | 1 | HASH UNIQUE | | 50086 | 635K| 1976K| 406 (3)| 00:00:05 | | 2 | TABLE ACCESS FULL| T_DISTINCT_TB | 50086 | 635K| | 161 (2)| 00:00:02 | -------------------------------------------------------------------------------------------- Note ----- - dynamic sampling used for this statement 统计信息 ---------------------------------------------------------- 5 recursive calls 0 db block gets 768 consistent gets 0 physical reads 0 redo size 732835 bytes sent via SQL*Net to client 37510 bytes received via SQL*Net from client 3377 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 50631 rows processed
相关文章推荐
- 计算两点之间的距离
- SQLite3初级使用
- JMS的规范,以及ActiveMQ中p2p和publish/subscriber2中模式
- RelativeLayout(Android)中实现控件平分屏幕
- 购买SSD固态硬盘须当心,你知道什么是SLC、 MLC、TLC闪存芯片颗粒吗?
- Ibatis的关联查询和关联结果
- Java中有关Null的9件事
- Ubuntu上配置Swift的开发环境,基于JetBrains的Clion编辑器
- Swift中闭包实现OC的block传值
- 机器学习---计算学习理论
- linux监控程序-程序自动重启方法
- ArcEngine修改像素值与像元值
- 【原创】网站抓包HttpWebRequest不返回Javascript生成的Cookie的解决办法
- linux 创建新用户并增加管理员权限
- 救赎者
- jquery中的选择器:has和:not的用法
- web前端笔试
- Android 高仿 频道管理----网易、今日头条、腾讯视频 (可以拖动的GridView)附源码DEMO
- 根据某一字段值相同合并字符串 - - SQL
- 顺时针打印矩阵