Sequence Near Exhaustion
pg_views: pg_sequences, information_schema.columns
Full detection logic, thresholds, and guided fixes ship in the product.
Book a demo →Overview
Postgres SERIAL and BIGSERIAL columns use sequences that increment monotonically. An INTEGER (int4) sequence maxes out at 2,147,483,647 (2.1 billion). A BIGINT (int8) sequence maxes out at 9.2 x 10^18. When a sequence is exhausted, any INSERT that triggers a nextval() fails with "integer out of range"—a hard outage.
Many applications start with SERIAL (int4), assuming they'll never exceed 2 billion rows, then find themselves there faster than expected due to high-volume writes, soft-deletes, or ephemeral records. insightral fires at 75% utilisation, giving lead time for the migration. The migration from int4 to int8 requires a table rewrite, which should be planned as a maintenance event.
See this rule in action
Full detection logic, thresholds, and guided fixes ship in the product. The licensed agent runs this check — and all others — continuously against your database, surfaces findings with AI explanations, and surfaces a guided remediation path inside the dashboard.
Book a demo →Common False Positives
- Sequences used for sharding key generation that wrap intentionally — these use CYCLE and are not subject to exhaustion.
- BIGSERIAL sequences showing high percentage — at 9.2 x 10^18 max, even 75% utilisation is astronomically far from practical exhaustion; this rule primarily targets int4 sequences.
Sequence Near Exhaustion — and 100+ more checks — in the licensed product
Full detection logic, thresholds, and guided fixes ship in the product.
Book a demo →Last updated: 2026-05-13 · View the rule library