DBMS_STATS包可以获得表的统计信息,在查询前,执行下面过程获得最新统计信息:
exec dbms_stats.gather_schema_stats(ownname=>'LIAOJL',cascade=>true);
还可以指定更多参数:
exec dbms_stats.gather_schema_stats( -
ownname => 'LIAOJL', -
options => 'GATHER AUTO', -
estimate_percent => dbms_stats.auto_sample_size, -
method_opt => 'for all columns size repeat', -
degree => 15 -
)
查询表行数:
select num_rows from user_tables where table_name='A';
还可以查询以下常用统计信息:
select STATUS,LOGGING from user_tables where table_name='A';
select PCT_FREE,PCT_USED,FREELISTS from user_tables where table_name='A';
select NUM_ROWS,BLOCKS from user_tables where table_name='A';
Comments
There are currently no comments
New Comment