2023-08-28

Postgres

Table of Contents

Postgres was designed for extensibility. See PostgreSQL Extensibility for details.

1. Optimize Storage Usage

https://hakibenita.com/postgresql-unused-index-size

  • Remove unused index
  • Clear bloat in index (i.e. updated rows that are stored as: original marked as deleted and new row inserted)
  • pgrepack to repack index
  • using partial index if you have index on a column whose some of the value you never query e.g. if a column is nullable and there are alot of nulls but you don't query with `WHERE colmn IS NULL` then create a partial index for non null values only for that column

2. Backup / Restore

pg_dump  super_app > backup.dump
pg_restore super_app < backup.dump

 pg_dump -U user_name -Fc database_name > dump_file_name

References


Found this interesting? Subscribe to new posts.
Any comments? Send an email.