- 最后登录
- 2014-3-6
- 在线时间
- 36 小时
- 威望
- 0
- 金钱
- 109
- 注册时间
- 2012-6-12
- 阅读权限
- 10
- 帖子
- 45
- 精华
- 0
- 积分
- 0
- UID
- 494
|
1#
发表于 2013-5-27 10:25:40
|
查看: 2841 |
回复: 2
你好,我在使用10053查看sql 语句时,发现了date类型打印的数值我不明白。于是我在测试环境下新建了个表,来说明这个问题。
建表语句
create table a(a1 int ,a2 date);
insert into a values(1,to_date('2012-10-22 14:22:22'));
insert into a values(2,to_date('2013-10-22 12:22:22'));
commit;
收集统计信息
begin
DBMS_STATS.GATHER_TABLE_STATS(ownname => user,
tabname => 'a',
estimate_percent => 20,
method_opt => 'for all columns size skewonly',
degree => DBMS_STATS.AUTO_DEGREE,
cascade=>TRUE);
end;
/
查看统计信息相关表
SQL> select LOW_VALUE,HIGH_VALUE from user_tab_col_statistics where table_name='A' AND COLUMN_NAME='A2';
LOW_VALUE HIGH_VALUE
---------------------------------------------------------------- ------------------------------------------
78700A160F1717 78710A160D1717
使用10053 trace
alter session set events '10053 trace name context forever ,level 1';
select * from a where a2>to_date('2013-10-01');
alter session set events '10053 trace name context off';
查看trace 文件:
SINGLE TABLE ACCESS PATH
Column (#2): A2(DATE)
AvgLen: 8.00 NDV: 2 Nulls: 0 Density: 0.5 Min: 2456224 Max: 2456589
Table: A Alias: A
Card: Original: 2 Rounded: 1 Computed: 1.00 Non Adjusted: 1.00
Access Path: TableScan
Cost: 2.00 Resp: 2.00 Degree: 0
Cost_io: 2.00 Cost_cpu: 8461
Resp_io: 2.00 Resp_cpu: 8461
Best:: AccessPath: TableScan
Cost: 2.00 Degree: 1 Resp: 2.00 Card: 1.00 Bytes: 0
请问:这个地方显示的date类型的数值究竟怎么转换的?
|
|