add edb 表大小查询
This commit is contained in:
parent
cb6c797863
commit
8bfc885370
27
postgresql_and_edb/edb表空间查询.md
Normal file
27
postgresql_and_edb/edb表空间查询.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
```sql
|
||||||
|
SELECT nspname || '.' || relname AS "relation",
|
||||||
|
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
|
||||||
|
FROM pg_class C
|
||||||
|
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
|
||||||
|
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
|
||||||
|
AND C.relkind = 'r'
|
||||||
|
ORDER BY pg_total_relation_size(C.oid) DESC;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT schemaname || '.' || relname AS "relation",
|
||||||
|
pg_size_pretty(pg_total_relation_size(relid)) AS "total_size",
|
||||||
|
pg_size_pretty(pg_table_size(relid) - pg_indexes_size(relid)) AS "table_size",
|
||||||
|
pg_size_pretty(pg_indexes_size(relid)) AS "index_size",
|
||||||
|
n_dead_tup
|
||||||
|
FROM pg_stat_user_tables
|
||||||
|
WHERE n_dead_tup > 0
|
||||||
|
ORDER BY n_dead_tup DESC;
|
||||||
|
```
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user