如果你谷歌的「postgresql表大小」,你會得到這個很好的查詢。 https://wiki.postgresql.org/wiki/Disk_Usage爲什麼不能看到我的模式大小
SELECT *, pg_size_pretty(total_bytes) AS total
, pg_size_pretty(index_bytes) AS INDEX
, pg_size_pretty(toast_bytes) AS toast
, pg_size_pretty(table_bytes) AS TABLE
FROM (
SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM (
SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME
, c.reltuples AS row_estimate
, pg_total_relation_size(c.oid) AS total_bytes
, pg_indexes_size(c.oid) AS index_bytes
, pg_total_relation_size(reltoastrelid) AS toast_bytes
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE relkind = 'r'
) a
) a;
我有一個模式app
:在結果
但犯規顯示:在結果
爲什麼app
架構犯規說明了什麼?
我嘗試第二個query,並返回空結果。
select table_name, pg_relation_size(table_name)
from information_schema.tables
where table_schema = 'app'
order by 2
'app'不包含任何表格。如果確實如此,你會在結果中看到它們。 –
@NickBarnes你是對的,應用程序只有功能和類型。 –