postgres - when table size takes up more and more space

Some quick command that can be helpful to clear off some of the table spaces.




-- Step 2. Check Table Size
SELECT pg_size_pretty(
  pg_total_relation_size('your-table-name')
) as table_size;

SELECT
  schemaname,
  relname,
  n_dead_tup
FROM pg_catalog.pg_stat_all_tables
WHERE relname = 'your-table-name';

-- before autovacuum
SELECT
  schemaname,
  relname,
  n_dead_tup
FROM pg_catalog.pg_stat_all_tables

--- run vaccum
vacuum your-table-name

-- after autovacuum
SELECT
  schemaname,
  relname,
  n_dead_tup
FROM pg_catalog.pg_stat_all_tables















Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm