如何提高一下语句的效率SQL语句如下,我用的是ORACLE 10G: select a.name, b.Code EntCode, b.Name EntlName, from WF_Flow a, WF_Model b where a.EntGid = '2000000000000000000000000009087A' and b.EntGid = '200000000000

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 03:50:28

如何提高一下语句的效率SQL语句如下,我用的是ORACLE 10G: select a.name, b.Code EntCode, b.Name EntlName, from WF_Flow a, WF_Model b where a.EntGid = '2000000000000000000000000009087A' and b.EntGid = '200000000000
如何提高一下语句的效率
SQL语句如下,我用的是ORACLE 10G:
select a.name,
b.Code EntCode,
b.Name EntlName,
from WF_Flow a, WF_Model b
where a.EntGid = '2000000000000000000000000009087A'
and b.EntGid = '2000000000000000000000000009087A'
and a.ModelGid = b.ModelGid
and a.FlowGid in (select FlowGid
from v_WF_Task
where EntGid = '2000000000000000000000000009087A'
and ExecGid = 'D855240574B5422FA2E15CAE9C3AB561'
and Stat in (0, 1, 2, 3, 4, 5)
union
select '' from dual)
Order By a.CreateDate Desc
我改成如下形式:
select a.name,
b.Code EntCode,
b.Name EntlName,
from WF_Flow a, WF_Model b
where a.EntGid = '2000000000000000000000000009087A'
and b.EntGid = '2000000000000000000000000009087A'
and a.ModelGid = b.ModelGid
and exists (select 1
from C
where EntGid = '2000000000000000000000000009087A'
and ExecGid = 'D855240574B5422FA2E15CAE9C3AB561'
and Stat in (0, 1, 2, 3, 4, 5)
and flowgid=a.flowgid)
Order By a.CreateDate Desc
这样效率反而不如上面的In,其中WF_Flow大概3W条记录,WF_Model大概10条记录,C表大概10W条记录,请高手指点,谢谢
Exists不是比in效率的吗?怎么会出现以上情况,非常不解

如何提高一下语句的效率SQL语句如下,我用的是ORACLE 10G: select a.name, b.Code EntCode, b.Name EntlName, from WF_Flow a, WF_Model b where a.EntGid = '2000000000000000000000000009087A' and b.EntGid = '200000000000
v_WF_Task 你这个好像是个视图吧?
你执行一下select FlowGid
from v_WF_Task
where EntGid = '2000000000000000000000000009087A'
and ExecGid = 'D855240574B5422FA2E15CAE9C3AB561'
and Stat in (0,1,2,3,4,5)
看看效率怎么样
-----------补充-------
in和exists效率问题你看下边这个

如何提高一下语句的效率SQL语句如下,我用的是ORACLE 10G: select a.name, b.Code EntCode, b.Name EntlName, from WF_Flow a, WF_Model b where a.EntGid = '2000000000000000000000000009087A' and b.EntGid = '200000000000 drop table if exists address_book;这句SQL语句是什么意思我备份的SQL语句中有这么一行, 求单表查询的hql语句怎么写sqL如下:select * from aaa20 where aaae2001 = '11111111';求hql语句写法 DROP-SQL语句属于一种什么功能的语句 DROP-SQL语句属于一种什么功能的语句 sql 语句中commit的作用 sql语句中join ,left join ,right join有什么区别我试着吧一条sql多表查询语句join换成left ,查询的数据一下变多了很多 sql语句 decimal(18, 如何提高英语语句教学的有效性 清空某表的全部数据的SQL语句是不是这样写?SQL语句:truncate table phpcms_ads_stat SQL的SELECT语句有哪几部分构成?,作用分别是什么?,如何利用它们表达查询要求? Oracle中如何的decode函数的使用下面是我的一个SQL语句,不用看其他的,就给我看一下decode中的语句,我的意思是当 c.Gsptype的值符合n (17, 18, 19, 21, 22, 101) And Not Between 50 And 99,为b.rgid,否则为0;这 sql如何取交集有这样两条sql语句select distinct id from a where id='123'select distinct id from a where id='456'我希望能把他们取得他们记录的交集,sql语句该如何写?错了 应该是这样的select distinct temid from a whe mysql_fetch_array与mysql_fetch_row用法的区别是什么?mysql_fetch_array与mysql_fetch_row用法的区别是我写了个sql类查询语句,一下是片段语句:/*** 查询方法* * @param $table 表名* @param $where 查询条件 * @param $fi sql语句中DISTINCT是什么意思 integer是什么意思?SQL语句中 js的if条件语句怎么写啊有如下两个文本框有如下js片段if (当文本框是input执行语句1,否则执行语句2){语句1}else{语句2}请问这个if语句如何写啊 SQL语句提取出中文的拼音首字母