hojas/interesting/postgres-survival-tips.md

1.1 KiB

Postgres survival tips

A guide built by the ratchet CEO with some tips from his own experience on building on top of Postgres: https://hatchet.run/blog/postgres-survival-guide.

Most stuff I already knew, some I found interesting, other bits I disagree.

  • Stuff I liked

    • "Use foreign keys with cascading deletes for low-volume tables, particularly where database consistency and correctness are important. Careful at higher volume." -> Very good call on the danger with the volume. People think foreign keys come with no trade-offs because they haven't dealt with a huge table that has them.
    • Paying attention to compound indices
    • Thi reference to expand and contract idea (also known as parallel change, but I prefer the former). Powerful. I had an intuition for this but never put a name on it: https://martinfowler.com/bliki/ParallelChange.html
    • He also uses Dalibo's query plan visualizer!!!
  • Stuff I would challenge

    • Using an incremental id on tables. This introduces a very limiting factor where data lacks unique identification outside of your database context, and distributed usage becomes hard.