AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
How to Pick a Partition Key in Postgres
All primary key and all unique keys unique indexes must include partitioning key. If you have surrogate key like id in some integer or uid u l id anything version 5 6 i don't know anything nowYou can see that you're huge table to be partitioned by range using timestamp for example created at right now You need to redefine your primary key to have both id column and created at column. Foreign keys which reference to this primary key they also need to be rebuilt when you redefine primary key it's also not an easy jobyou need to think about if you need to do it for zero downtime, he says.