🧀 BigCheese.ai

Social

Common DB schema change mistakes in Postgres

🧀

The article outlines common mistakes during database schema changes, stressing the importance of proper preparations and testing to avoid performance issues and downtime. It provides multiple cases reflecting potential problems with actionable advice. The article underscores testing schema changes using realistic data volumes and the use of Database Lab Engine for efficient CI/CD pipeline integration.

  • DDL and massive DML in one transaction can cause performance issues.
  • Exclusive locks should be held for the shortest time possible.
  • Always use CREATE INDEX CONCURRENTLY in OLTP.
  • 4-byte integer PKs should be avoided for large tables.
  • Test schema changes with full-size database clones.