oracle之date 查询性能优化
来源:互联网 发布:淘宝介入后还能评价吗 编辑:程序博客网 时间:2024/05/29 23:24
创建测试表
created table test(
id varchar2(20) not null,
dtime date
)
插入6000000数据
declare
i number;
k number;
begin
k:=0;
for i in 1 .. 6000000 loop
insert into test(id,dtime) values('1',sysdate-k);
if i/10000 =0 then
k:=k+1;
commit;
end if;
end loop;
commit;
end;
第一种查询语句
select * from test where to_char(dtime,'yyyy-MM-dd')='2013-02-12';
用时:1654ms
第二种查询语句
select * from test t where dtime between to_date('2012-02-12 00:00:00','yyyy-MM-dd HH24:mi:ss')
and to_date('2012-02-12 23:59:59','yyyy-MM-dd HH24:mi:ss');
用时:203ms
第三种查询语句
select * from test where dtime = to_date('2012-02-12 00:00:00','yyyy-MM-dd HH24:mi:ss');
用时:188ms
说明:字符进行比较是字节码的比较
date是整数比较
请纠错!谢谢
- oracle之date 查询性能优化
- oracle查询性能优化
- oracle 查询性能优化
- Oracle查询性能优化
- Oracle查询性能优化
- Oracle查询性能优化
- ORACLE通用查询性能优化
- Oracle分页查询性能优化
- Trafodion 性能优化之查询性能
- 《高性能MySQL》之查询性能优化
- MYSQL性能优化之SQL查询优化
- Oracle子查询性能优化一例
- (转)Oracle查询性能优化
- oracle性能优化之索引
- Oracle性能优化之COUNT
- oracle之 sql性能优化
- Oracle性能优化之统计分析
- Oracle性能优化之Rollback Segment优化
- linux下Vi命令大全
- 追MM与设计模式
- stm32 usbHID调试小结
- Java设计模式
- Android NDK编译之undefined reference to 'JNI_CreateJavaVM'
- oracle之date 查询性能优化
- Lucene的使用
- (C#基础)异常处理二三事
- Double the virtual joystick
- mtl库在GCC编译器下的使用
- NYOJ 士兵杀敌(二) 树状数组
- File类使用
- 两个链表的合并
- 整理-非常常用的java公共方法