TLDR
- don't use the same server as your production system
- upgrade to pg 12+ (or avoid common table expressions in your queries)
- go easy on indexes – less is more
- consider partitioning long tables
- ensure you're not I/O-bound
- vacuum analyze after bulk insertion
- explore parallel queries
- increase statistics sampling
- use fewer columns on frequently-queried tables
- at scale consider a dedicated warehouse
Read More
Hide