有一张数据表,上生产后数据量是千万级的,目前我在开发机上测试里面存储的也有上百万的数据
字段有119个,这是张数据源表,我从里面取数据的时候每次select操作特耗时,因此我在
该表的一个字段上建了索引(data_date 字段类型varchar2(10) ),但是索引建好以后始终没有生效,删除重建以及rebuild
也不行
-----做了如下的分析也是不行
drop index IDX_ETB_DDATE1 ;
analyze table dwh_etb_monthly compute statistics ;
analyze table dwh_etb_monthly compute statistics for all indexed columns;
analyze table dwh_etb_monthly compute statistics for table for all indexes for all indexed columns;
create index idx_dwh_ddate on dwh_etb_monthly(data_date)
-----然后我做查询的语句是:
select * from dwh_etb_monthly t where t.data_date = '2011-03-31'
执行计划是SELECT STATEMENT, GOAL = ALL_ROWS Cost=14060 Cardinality=273095 Bytes=108418715
TABLE ACCESS FULL Object owner=DATACORE Object name=DWH_ETB_MONTHLY Cost=14060 Cardinality=273095 Bytes=108418715
字段有119个,这是张数据源表,我从里面取数据的时候每次select操作特耗时,因此我在
该表的一个字段上建了索引(data_date 字段类型varchar2(10) ),但是索引建好以后始终没有生效,删除重建以及rebuild
也不行
-----做了如下的分析也是不行
drop index IDX_ETB_DDATE1 ;
analyze table dwh_etb_monthly compute statistics ;
analyze table dwh_etb_monthly compute statistics for all indexed columns;
analyze table dwh_etb_monthly compute statistics for table for all indexes for all indexed columns;
create index idx_dwh_ddate on dwh_etb_monthly(data_date)
-----然后我做查询的语句是:
select * from dwh_etb_monthly t where t.data_date = '2011-03-31'
执行计划是SELECT STATEMENT, GOAL = ALL_ROWS Cost=14060 Cardinality=273095 Bytes=108418715
TABLE ACCESS FULL Object owner=DATACORE Object name=DWH_ETB_MONTHLY Cost=14060 Cardinality=273095 Bytes=108418715
解决方案 »
- 打击死了
- 安装]windows平台下Oracle RAC集群系统安装过程
- Oracle 怎么才能不区分大小写
- ORA-12203: TNS:unable to connect to destination不知道是什么问题
- 用powerbuilder+oracle开发的程序,能把后台数据库从oracle改成sql server吗
- 问个sql语句关于排名的问题
- 我刚学oracle,有个问题,从oracle中如何查看当前打开游标数等一些信息?
- 现在大家在看哪本数据库方面的杂志?介绍一下
- ORACLE 8.1.6 目录服务访问怎么配置???
- 分段查询的sql语句怎样写?
- 紧急求助:尝试加载 Oracle 客户端库时引发 BadImageFormatException。如果在安
- 百万级朝上数据量的表如果允许见多少索引合适
SQL> select * from dwh_etb_monthly t where t.data_date = '2011-03-31';已选择253619行。
执行计划
----------------------------------------------------------
Plan hash value: 1519047794-------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
|-------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 273K| 103M| 14060 (1)| 00:02:49 ||* 1 | TABLE ACCESS FULL| DWH_ETB_MONTHLY | 273K| 103M| 14060 (1)| 00:02:49 |-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
--------------------------------------------------- 1 - filter("T"."DATA_DATE"='2011-03-31')
统计信息
----------------------------------------------------------
1 recursive calls
0 db block gets
67033 consistent gets
51218 physical reads
0 redo size
42214108 bytes sent via SQL*Net to client
186393 bytes received via SQL*Net from client
16909 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
253619 rows processed
select /*+index(idx_dwh_ddate)*/ * from dwh_etb_monthly t where t.data_date = '2011-03-31'
--强制索引语法没写对
select /*+ index(t,idx_dwh_ddate) */
t.*
from dwh_etb_monthly t
where t.data_date = '2011-03-31'--另外如果这个表dml操作不多的话建一个 bit map 索引试试
create bit map index index_name on dwh_etb_monthly(data_date);