表使用空间的估算[@more@]表使用空间的估算
1、对表和索引进行分析,查询user_tables得到表的容量;
exec dbms_stats.gather_table_stats(user, 'TABLE_NAME', cascade => true);
select avg_row_len from user_tables where table_name = 'TABLE_NAME';
2、avg_row_len为表的平均行长,如果记录数为n,则表占用空间为avg_row_len bytes * n;
3、select segment_name, segment_type, bytes from user_segments where segment_name
in ('TABLE_NAME', 'INDEX_NAME');
4、select trunc((索引字节数 / 表字节数) * 100) ind_percent from dual;
得到索引和表大小的百分比;
5、则该表的空间使用量为 = avg_row_len * n (1 + ind_percent / 100)
1、对表和索引进行分析,查询user_tables得到表的容量;
exec dbms_stats.gather_table_stats(user, 'TABLE_NAME', cascade => true);
select avg_row_len from user_tables where table_name = 'TABLE_NAME';
2、avg_row_len为表的平均行长,如果记录数为n,则表占用空间为avg_row_len bytes * n;
3、select segment_name, segment_type, bytes from user_segments where segment_name
in ('TABLE_NAME', 'INDEX_NAME');
4、select trunc((索引字节数 / 表字节数) * 100) ind_percent from dual;
得到索引和表大小的百分比;
5、则该表的空间使用量为 = avg_row_len * n (1 + ind_percent / 100)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9523925/viewspace-1037606/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9523925/viewspace-1037606/