查詢gaussdb資料庫表空間大小排名

2021-10-19 15:18:45 字數 757 閱讀 4797

某平台拉鍊設定,長時間執行後會給資料庫帶來冗餘資料。以下介紹查詢高斯庫表空間大小排名的查詢語句。

語句select

table_name,

pg_size_pretty(table_size) as table_size,

pg_size_pretty(indexes_size) as indexes_size,

pg_size_pretty(total_size) as total_size

from (

select

table_name,

pg_table_size(table_name) as table_size,

pg_indexes_size(table_name) as indexes_size,

pg_total_relation_size(table_name) as total_size

from (

select (』"』 || table_schema || 『"."』 || table_name || 『"』) as table_name

from information_schema.tables

) as all_tables

order by total_size desc

) as pretty_sizes

結果:

清理truncate table 表名

查詢資料庫表所佔空間

if object id tempdb.tb temp space isnot null drop table tb temp space gocreate table tb temp space name varchar 500 rows int,reserved varchar 50 data ...

ORACLE資料庫表空間查詢

前提 必須有dba許可權,有許可權查詢表空間使用情況 檢視表空間使用情況 select upper f.tablespace name 表空間名 d.tot grootte mb 表空間大小 m d.tot grootte mb f.total bytes 已使用空間 m to char round...

Oracle資料庫查詢使用者表空間查詢 建立

檢視資料庫裡面所有使用者,前提是你是有dba許可權的帳號,如sys,system select from dba users 檢視你能管理的所有使用者 select from all users 檢視當前使用者資訊 select from user users 查詢使用者所對應的表空間 select...