sql语句性能问题(1)select b.x_Client_Satisfaction from siebel.s_srv
来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/07/07 20:20:17
sql语句性能问题
(1)select b.x_Client_Satisfaction from siebel.s_srv_req
a,siebel.s_Srv_Req_x b
where a.row_id = b.par_row_id
and a.created > to_date('2013-11-20
00:00:00','yyyy-mm-dd hh24:mi:ss')-8/24
and b.x_Client_Satisfaction is not null;
(2)select b.x_Client_Satisfaction from siebel.s_srv_req
a,siebel.s_Srv_Req_x b
where a.row_id = b.par_row_id
and a.created > to_date(to_char(sysdate,'yyyy-mm-dd')||'00:00:00','yyyy-mm-dd
hh24:mi:ss')-8/24
and b.x_Client_Satisfaction is not null;
这两个语句中加了限制时间的条,数据量很大时第二个语句跑不动,第一个还行,这是为什么?
(1)select b.x_Client_Satisfaction from siebel.s_srv_req
a,siebel.s_Srv_Req_x b
where a.row_id = b.par_row_id
and a.created > to_date('2013-11-20
00:00:00','yyyy-mm-dd hh24:mi:ss')-8/24
and b.x_Client_Satisfaction is not null;
(2)select b.x_Client_Satisfaction from siebel.s_srv_req
a,siebel.s_Srv_Req_x b
where a.row_id = b.par_row_id
and a.created > to_date(to_char(sysdate,'yyyy-mm-dd')||'00:00:00','yyyy-mm-dd
hh24:mi:ss')-8/24
and b.x_Client_Satisfaction is not null;
这两个语句中加了限制时间的条,数据量很大时第二个语句跑不动,第一个还行,这是为什么?
![sql语句性能问题(1)select b.x_Client_Satisfaction from siebel.s_srv](/uploads/image/z/4443553-1-3.jpg?t=sql%E8%AF%AD%E5%8F%A5%E6%80%A7%E8%83%BD%E9%97%AE%E9%A2%98%EF%BC%881%EF%BC%89select+b.x_Client_Satisfaction+from+siebel.s_srv)
这里的主要区别就是第二个语句用了sysdate函数取系统时间,这里看来是将这个值作为变量处理了.
第一个语句优化器是将 to_date('2013-11-20 00:00:00','yyyy-mm-dd hh24:mi:ss')-8/24直接处理好后作为常量执行语句,所以索引等都能够使用
第二个语句优化器to_date(to_char(sysdate,'yyyy-mm-dd')||'00:00:00','yyyy-mm-dd hh24:mi:ss')-8/24作为变量处理的话,就不会走created的索引,所以变成表扫描的话就会比较慢.
第一个语句优化器是将 to_date('2013-11-20 00:00:00','yyyy-mm-dd hh24:mi:ss')-8/24直接处理好后作为常量执行语句,所以索引等都能够使用
第二个语句优化器to_date(to_char(sysdate,'yyyy-mm-dd')||'00:00:00','yyyy-mm-dd hh24:mi:ss')-8/24作为变量处理的话,就不会走created的索引,所以变成表扫描的话就会比较慢.
sql语句性能问题(1)select b.x_Client_Satisfaction from siebel.s_srv
SQL语句理解 select * from B where (select count(1) as num from A
SQL 语句 "SELECT * FROM {{table}} WHERE `fleet_end_time`
if (pastart = -1) sql.append("select * from("); sql.append("
ms sql :select * from (select *from b) as xxx where 和 select
select id from (select * from tree)这个sql语句有什么错吗
sql语句中参数乘法select top 4 *from UserInfowhere ID not in(select
SQL问题?SELECT语句中与HAVING子句通常同时使用的是( )子句。A.ORDER BY B.WHERE C.G
解释数SQL面的 select * from a, b 是什么意思
sql.append(" SELECT * FROM test_user
sql 语句中 select * from table where 2=1 的where2=1有什么意思和作用
请问大侠,我要在function()下写一个动态sql语句,如select * from A WHERE name in