TLDR Tech / Data
How to Achieve Pruning When Querying by Non-Partitioned Columns in PostgreSQL
PostgreSQL can prune partitions even when queries filter on a non-partition key, provided that column follows predictable ranges correlated with the partition key. By adding CHECK constraints for those ranges, including separate ranges for outliers, the optimizer can skip irrelevant partitions and avoid scanning every local index.
Read the full story