The Pitfalls of Partitioning Postgres Yourself
Posted25 days agoActive22 days ago
hatchet.runTech Discussionstory
informativeneutral
Debate
20/100
Data_storageBest Practices
Key topics
Data_storage
Best Practices
Discussion Activity
Light discussionFirst comment
3d
Peak period
5
72-78h
Avg / period
3
Key moments
- 01Story posted
Dec 16, 2025 at 1:21 PM EST
25 days ago
Step 01 - 02First comment
Dec 19, 2025 at 4:09 PM EST
3d after posting
Step 02 - 03Peak activity
5 comments in 72-78h
Hottest window of the conversation
Step 03 - 04Latest activity
Dec 20, 2025 at 2:34 AM EST
22 days ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 46292148Type: storyLast synced: 12/20/2025, 8:40:36 AM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
(plus an interesting discussion in the comments of that post on how the query planner chose a certain row estimate in the specific case that Laurenz shared!)
The other thing I'll add is that we still haven't figured out:
1. An optimal ANALYZE schedule here on parent partitions; we're opting to over-analyze than under-analyze at the moment, because it seems like our query distribution might change quite often.
2. Whether double-partitioned tables (we have some tables partitioned by time series first, and an enum value second) need analyze on the intermediate tables, or whether the top-level parent and bottom-level child tables are enough. So far just the top-level and leaf tables seem good enough.
But TIL, I didn't realize you could do multiple levels of partitioning in modern postgres, found this old blog post that touches on it https://joaodlf.com/postgresql-10-partitions-of-partitions.h...
Something that stresses me is the number of partitions - we have some weekly partitions that have a long retention period, and whilst it hasn't become a problem yet, it feels like a ticking time bomb as the years go on.
Would a multi level partitioning scheme of say year -> week be a feasible way to side step the issues of growing partition counts?
It prompted Laurenz to submit the documentation patch that is cited in the article. In the discussion of the patch itself, people seem to conclude that it's a good improvement to the docs, but that the behaviour itself is a bit of a footgun. [2]
[1]: https://stackoverflow.com/questions/73951604/autovacuum-and-...
[2]: https://www.postgresql.org/message-id/Y8cQJIMFAe7QT73/%40mom...