Skip to content

Partitioning: Use bigint primary key by default

For new tables, we generally use bigint for the primary key. Typically, large tables are good candidates for partitioning and large tables require bigint primary keys at some point.

We already have a couple of examples for tables where integer overflow risk cannot be ignored.

The idea is to address this concern while we partition tables:

  1. When we create a copy of the table, create the table with a bigint primary key.
  2. Install triggers, copy data over etc
  3. Switch

So this would solve both concerns at the same time: partitioning plus the overflow risk.

Edited by Andreas Brandl