TLDR Dev · ARTICLES & TUTORIALS

UNCONVENTIONAL POSTGRESQL OPTIMIZATIONS

hakibenita.com20 min read

Summary from the TLDR Dev newsletter

This article goes over some unconventional PostgreSQL optimization techniques that go beyond standard practices like simple indexing. One method involves enabling `constraint_exclusion` to remove unnecessary full table scans when queries contradict existing check constraints. Another technique optimizes for lower cardinality by creating function-based indexes (e.g., on just the date part of a timestamp), which are made consistently usable and efficient with virtual generated columns.