DB2语句优化……

youbin_ 2007-08-07 03:13:14
为什么我将下面的语句
(tax_date < current timestamp or hydraulic_date < current timestamp or inside_date < current timestamp);
修改为
(tax_date < current timestamp and year(tax_date) = year(current timestamp) or hydraulic_date < current timestamp and year(hydraulic_date ) = year(current timestamp) or inside_date < current timestamp and year(inside_date ) = year(current timestamp));
后,耗时增加了n倍??请高手指点下!!

...全文
119 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
y_cl68 2007-08-09
  • 打赏
  • 举报
回复
用函数year的话,索引会不起作用,做全表扫描
yangxiao_jiang 2007-08-08
  • 打赏
  • 举报
回复
看看执行计划,那里耗时比较多

5,889

社区成员

发帖
与我相关
我的任务
社区描述
IBM DB2 是美国IBM公司开发的一套关系型数据库管理系统,它主要的运行环境为UNIX(包括IBM自家的AIX)、Linux、IBM i(旧称OS/400)、z/OS,以及Windows服务器版本
社区管理员
  • DB2
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧