有如下sql语句:select count(1)
from t_project_one_estimate t
where exists (select t1.statistic_id
from t_project_one_estimate t1
where t1.statistic_close_state = 2);表t_project_one_estimate现在有一千多万条数据,每条数据都有状态,现在要查询是否存在状态为2的,如果存在就可以返回了,我写了如上sql语句但是查询速度很慢,现在请问下各位大哥,怎么优化下才能提升效率啊,或者其它方法也可以,小弟先谢谢各位了。只要说的有道理就给分。
from t_project_one_estimate t
where exists (select t1.statistic_id
from t_project_one_estimate t1
where t1.statistic_close_state = 2);表t_project_one_estimate现在有一千多万条数据,每条数据都有状态,现在要查询是否存在状态为2的,如果存在就可以返回了,我写了如上sql语句但是查询速度很慢,现在请问下各位大哥,怎么优化下才能提升效率啊,或者其它方法也可以,小弟先谢谢各位了。只要说的有道理就给分。
解决方案 »
- 一个关于游标的问题
- 触发器语法上求有点困惑
- 关于rman不完全恢复时scn问题?
- 在利用PL/SQL存储过读取数据在JSP上打印出错
- 求视频教程:PL/SQL系列高级编程及大型B2C商城项目数据库实战
- 取制定月份的天数
- 如何显示有重复记录的所有数据
- cctv奥运的项目,急活!这个奥运奖牌榜的排行的sql怎么写?多谢!!!
- 高分请教! Oracle中的初始化参数文件initxxxx.ora中的各种值如 : shared_pool_size , sort_area_size等等应该如何根据实际情况来分配及赋
- 200分。我的ORACLE8。16安装完毕后。有装了其他软件。再登陆时不成功,显示:凭证检索失败!
- 连接ORACLE数据库的问题(急急急)
- 求一条简单的SQL语句
from dual
where exists (select 1
from t_project_one_estimate t1
where t1.statistic_close_state = 2);
where t1.statistic_close_state = 2
and rownum = 1;
from t_project_one_estimate t1
where t1.statistic_close_state = 2 and rownum=1
会不会好点?
照LZ的意思 是不是直接 select 1
from t_project_one_estimate
where statistic_close_state = 2就行了?
‘ilovemk’哥(姐)你 说说。。