在以下版本中使用dbms_stats 收集的信息有误
Oracle 9i Release 2 (9.2.0)
Oracle Database 10g Release 1(10.1.0)
Oracle Database 10g Release 1(10.1.0)
原因是有bug
BUG:3491127
在Oracle Database 10g Release 2(10.2.0)中修复
SQL> create table test
2 (col1 number(5) ,
3 col2 number(3)
4 )
5 partition by range(col1,col2)
6 (partition p1 values less than (1,6) ,
7 partition p2 values less than (maxvalue,maxvalue)
8 )
9 ;
Table created.
SQL> select * from test;
COL1 COL2
---------- ----------
1 1
1 2
1 3
1 4
1 5
2 1
6 rows selected.
SQL> create index idx_test on test
(
col1 ,
col2
)
global partition by range(col1,col2)
(
partition p1 values less than (1,6) ,
partition p2 values less than (maxvalue,maxvalue)
);
Index created.
SQL> exec dbms_stats.gather_index_stats( wnname => 'sys', indname => 'IDX_TEST');
PL/SQL procedure successfully completed.
SQL> select partition_name, num_rows from user_ind_partitions where
PARTITION_NAME='P1' or PARTITION_NAME='P2';
PARTITION_NAME NUM_ROWS
------------------------------ ----------
P1 5
P2 1
统计信息正确
2 (col1 number(5) ,
3 col2 number(3)
4 )
5 partition by range(col1,col2)
6 (partition p1 values less than (1,6) ,
7 partition p2 values less than (maxvalue,maxvalue)
8 )
9 ;
Table created.
SQL> select * from test;
COL1 COL2
---------- ----------
1 1
1 2
1 3
1 4
1 5
2 1
6 rows selected.
SQL> create index idx_test on test
(
col1 ,
col2
)
global partition by range(col1,col2)
(
partition p1 values less than (1,6) ,
partition p2 values less than (maxvalue,maxvalue)
);
Index created.
SQL> exec dbms_stats.gather_index_stats( wnname => 'sys', indname => 'IDX_TEST');
PL/SQL procedure successfully completed.
SQL> select partition_name, num_rows from user_ind_partitions where
PARTITION_NAME='P1' or PARTITION_NAME='P2';
PARTITION_NAME NUM_ROWS
------------------------------ ----------
P1 5
P2 1
统计信息正确
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24756186/viewspace-746060/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24756186/viewspace-746060/