PSQL cheatsheet
Data dump
- Dumps data from select to CSV file
\copy (select * from table) to '/tmp/dump.csv' with csv header- Get the real total disk table size (inc. indexes)
SELECT pg_size_pretty(pg_total_relation_size('table'))
\copy (select * from table) to '/tmp/dump.csv' with csv headerSELECT pg_size_pretty(pg_total_relation_size('table'))