问题描述
嗨-我刚刚在我们的一个架构上运行了完整的架构统计信息。完整的架构统计信息完成后,我检查了dba_tables中的num_rows和dba_indexes中的num_rows。来自dba_tables的num_rows看起来不错,但来自dba_indexes的num_rows对于特定表显示为0。为什么会这样?我们如何解决这个问题?
专家解答
这些统计数据可能非常准确。不要忘记完全空条目没有索引,因此索引中的行数可以小于表中的行数,例如
SQL> create table t as
2 select rownum x from dual
3 connect by level <= 10;
Table created.
SQL>
SQL> alter table t add y int;
Table altered.
SQL>
SQL> select * from t;
X Y
---------- ----------
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SQL>
SQL> create index ix on t ( y ) ;
Index created.
SQL>
SQL> exec dbms_stats.gather_table_stats('','T')
PL/SQL procedure successfully completed.
SQL>
SQL> select num_rows from user_tables where table_name = 'T';
NUM_ROWS
----------
10
1 row selected.
SQL>
SQL> select num_rows from user_indexes where table_name = 'T';
NUM_ROWS
----------
0
1 row selected.
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




