索引的问题 select a.xxxx from A a inner join B b on a.id = b.id A,B 两表的数据量都很大,我在两表的id上都加了索引,但是用TOAD 测试,发现查询的时候还是出现Table Access full的问题请问有什么好的方法解决吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1. create index idx_id_xxxx on A(id, xxxx) nologging;2. 分析表和索引 除了連接條件外,應該還要有其他條件才能避免full table scan吧 是不是你统计信息过旧?导致CBO选择了错误的优化方式?你对表和索引进行分析下呢:analyze table A delete statistics;analyze table A compute statistics ; 建议楼主这样:select a.xxxx from A a , B b where a.id = b.id emp表比较大时,而且deptno = 10条件能查询出表中大部分的数据如(50%)。如该表共有4000万行数据,共放在有500000个数据块中,每个数据块为8k,则该表共有约4G,则 这么多的数据不可能全放在内存中,绝大多数需要放在硬盘上。此时如果该查询通过索引查询,则是你梦魇的开始。 db_file_multiblock_read_count参数的值200。如果采用全表扫描,则需要 500000/db_file_multiblock_read_count=500000/200=2500次I/O。但是如果采用索引扫描,假设 deptno列上的索引都已经cache到内存中,所以可以将访问索引的开销忽略不计。因为要读出4000万x 50% = 2000万数据,假设在读这2000万数据时,有99.9%的命中率,则还是需要20000次I/O,比上面的全表扫描需要的2500次多多了,所以在这 种情况下,用索引扫描反而性能会差很多。在这样的情况下,用全表扫描的时间是固定的,但是用索引扫描的时间会随着选出数据的增多使查询时间相应的延长。看看这段话,希望对你有些帮助 因为楼主没有where条件,创建的index又能没起作用什么的 --分析索引跟表试试analyze table tbname compute statisticsanalyze index idxname compute statisticsselect a.xxxx from A a,B b where a.id = b.id select a.xxxx from A a,B b where a.id = b.id 跟select a.xxxx from A a join B b on a.id=b.id有效率差别么 关于查询哪些表包含了指定内容的问题 Spring Security 连接Oracle 找不到SID drop user XXX cascade; 从Oracle数据库中访问MYSQL数据库中的表 oralce怎么把一个导出的dmp其中的存储过程导入 急。。急。。急。。急。。急。。急。。急。。 oracle的sql语句能以最大日期作为查询条件吗?能的话怎么写 触发器中不让执行commit,怎么办? insert into...select...时是行锁还是表锁? oracle客户端安装 触发器怎么安装到用户的系统中去? 寻找金算盘数据库字典 Oracle中的正则表达式支持零宽断言吗
2. 分析表和索引
你对表和索引进行分析下呢:
analyze table A delete statistics;analyze table A compute statistics ;
select a.xxxx from A a , B b where a.id = b.id
看看这段话,希望对你有些帮助
analyze table tbname compute statistics
analyze index idxname compute statisticsselect a.xxxx from A a,B b where a.id = b.id
跟
select a.xxxx from A a join B b on a.id=b.id有效率差别么