首页 > 数据库技术 > 详细

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

时间:2017-12-21 21:11:02      阅读:244      评论:0      收藏:0      [点我收藏+]

--表名,表占用空间大小(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 表的行数、表占用空间大小,列的非空行数、列占用空间大小 查询

原文:http://www.cnblogs.com/phoenix-smile/p/8082434.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!