--表名,表占用空间大小(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.
//先进去MySQL自带管理库:information_schema //自己的数据库:rokid_cas_music_test //自己的表:data_song_thirdparty mysql> use information_schema; Database changed mysql> select data_length,index_length from information_schema.tables where table_schema='rokid_cas_music_te
查询用户创建的表 select * from user_tab_comments; -- 查询本用户的表,视图等. select * from user_col_comments; -- 查询本用户的表的列名和注释. 查询所有表大小 select Segment_Name, Sum(bytes) / 1024 / 1024 / 1024 "size(DB)" From User_Extents Group By Segment_Name order by "size(DB)&
) ) if object_id('tempdb..#space') is not null drop table #space ),rows ),data ),index_size ),unused )) declare sp cursor local for select '['+name+']' from sysobjects where type = 'u' open sp fetch sp into @name begin set @sql = 'insert into #space
一.查询所有数据库占用空间大小 SELECT TABLE_SCHEMA, CONCAT( TRUNCATE(SUM(data_length) / 1024 / 1024, 2), ' MB' ) AS data_size, CONCAT( TRUNCATE(SUM(index_length) / 1024 / 1024, 2), 'MB' ) AS index_size FROM information_schema.tables GROUP BY TABLE_SCHEMA ORDER BY d