当前位置:Gxlcms > 数据库问题 > Oracle 表的行数、表占用空间大小,列的非空行数、列占用空间大小 查询

Oracle 表的行数、表占用空间大小,列的非空行数、列占用空间大小 查询

时间:2021-07-01 10:21:17 帮助过:3人阅读

--表名,表占用空间大小(MB),行数
select table_name, round(num_rows * avg_row_len /1024/1024, 8) as total_len, num_rows

from user_tables

where table_name = ‘表名‘

order by table_name;

 

--表名,列名,列占用空间大小(MB),非空行数

select c.table_name, c.column_name, round((t.num_rows - c.num_nulls) * c.avg_col_len /1024/1024, 8) as total_len, t.num_rows - c.num_nulls as nums

from user_tab_columns c

join user_tables t on c.TABLE_NAME = t.TABLE_NAME

where c.table_name = ‘表名‘

order by c.column_name;

Oracle 表的行数、表占用空间大小,列的非空行数、列占用空间大小 查询

标签:col   log   user   占用   select   gpo   table   ora   tables   

人气教程排行