显示psql内部操作
最近更新时间: 2024-10-17 17:10:00
postgres=# \set ECHO_HIDDEN on
postgres=# \dt+ t
********* QUERY **********
SELECT n.nspname as "Schema",
c.relname as "Name",
CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' WHEN 'f' THEN 'foreign table' WHEN 'p' THEN 'table' END as "Type",
pg_catalog.pg_get_userbyid(c.relowner) as "Owner",
pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as "Size",
pg_catalog.pg_size_pretty(pg_catalog.pg_allocated_table_size(c.oid)) as "Allocated Size",
pg_catalog.obj_description(c.oid, 'pg_class') as "Description"
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','p','s','')
AND n.nspname !~ '^pg_toast'
AND c.relname ~ '^(t)$'
AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;
**************************
List of relations
Schema | Name | Type | Owner | Size | Allocated Size | Description
--------+------+-------+-------+-------+----------------+-------------
public | t | table | tbase | 16 kB | 0 bytes |
(1 row)
#禁用显示psql内部操作
postgres=# \set ECHO_HIDDEN off