两张表,各表都有几十万数据,现在要通过索引字段关联起来,在进行web查询的的时候非常慢!
以下是我的表及查询语句
create table gc_dfss(
hbs_bh char(8) not null,
dffs_ny date not null,
hj_dl varchar(20) null,
);
create table gc_dfys(
hbs_bh char(8) not null,
dffs_ny date not null,
ss_df varchar(20) null,
);
分别在两表上建立两个索引 hbs_bh,dffs_nys
select *from (
select rownum bj,t.* from (
select a.hbs_bh,a.dffs_ny ,b.ss_df from gc_dfss a,gc_dfys b where a.hbs_bh=b.hbs_bh and a.dffs_ny=b.dffs_ny ) t where rownum<20 ) u where u.bj>0 ; 我在plsql中测试,单表是很快的,但只要一关联起来就很慢,一般显示前二十条要7秒多。
以下是我的表及查询语句
create table gc_dfss(
hbs_bh char(8) not null,
dffs_ny date not null,
hj_dl varchar(20) null,
);
create table gc_dfys(
hbs_bh char(8) not null,
dffs_ny date not null,
ss_df varchar(20) null,
);
分别在两表上建立两个索引 hbs_bh,dffs_nys
select *from (
select rownum bj,t.* from (
select a.hbs_bh,a.dffs_ny ,b.ss_df from gc_dfss a,gc_dfys b where a.hbs_bh=b.hbs_bh and a.dffs_ny=b.dffs_ny ) t where rownum<20 ) u where u.bj>0 ; 我在plsql中测试,单表是很快的,但只要一关联起来就很慢,一般显示前二十条要7秒多。
解决方案 »
- oracle 11.2.0 报错的一系列错误信息摘要,希望朋友support
- 求一条简单update语句
- oracle 合并多条查询记录为一条查询记录
- 如何用SQL语句查询出指定的存储过程的参数及其类型
- 提个查询的问题
- 不能启动Oracle,请帮忙!
- 在ORACLE中,怎样用SQL语句返回一个字段名?
- oracle7.3.3 的数据库怎么转化成oracle8i,在线等待,
- 请问:hibernate.cfg.xml文件中连接oracle的驱动是什么?
- oracle错误代码ora-01013的疑问
- 求助:在PL/SQL中能否像c++定义struct结构,如何初始化
- 大家看看我再用pro*c时发生编译错误,说什么left join有问题,大家用过join嘛
from gc_dfss a,gc_dfys b
where a.hbs_bh=b.hbs_bh
and a.dffs_ny=b.dffs_ny
where a.hbs_bh=b.hbs_bh and a.dffs_ny=b.dffs_ny
and rownum<20