# Gapless sequences Page: https://stenobird.com/podcast/postgres-fm-5565051/gapless-sequences Text version: https://stenobird.com/podcast/postgres-fm-5565051/gapless-sequences.md Podcast: [Postgres FM](https://stenobird.com/podcast/postgres-fm-5565051) Published: 2025-10-31T14:00:00+00:00 Episode link: https://share.transistor.fm/s/51ef75f8 Audio file: https://media.transistor.fm/51ef75f8/d50337bd.mp3 Processing state: not_requested JSON: https://stenobird.com/v1/public/podcasts/postgres-fm-5565051/episodes/gapless-sequences Duration seconds: 2389 ## Resource Nik and Michael discuss the concept of gapless sequences — when you might want one, why sequences in Postgres can have gaps, and an idea or two if you do want them. And one quick clarification: changing the CACHE option in CREATE SEQUENCE can lead to even more gaps, the docs mention it explicitly. Here are some links to things they mentioned: CREATE SEQUENCE https://www.postgresql.org/docs/current/sql-createsequence.html Sequence Manipulation Functions https://www.postgresql.org/docs/current/functions-sequence.html One, Two, Skip a Few (post by Pete Hamilton from Incident io) https://incident.io/blog/one-two-skip-a-few Postgres sequences can commit out-of-order (blog post by Anthony Accomazzo / Sequin) https://blog.sequinstream.com/postgres-sequences-can-commit-out-of-order Logical Replication of sequences (hackers thread) https://www.postgresql.org/message-id/flat/CAA4eK1LC%2BKJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ%40mail.gmail.com Synchronization of sequences to subscriber (patch entry in commitfest) https://commitfest.postgresql.org/patch/5111/ Get or Create (episode with Haki Benita) https://postgres.fm/episodes/get-or-create German tank problem https://en.wikipedia.org/wiki/German_tank_problem ~~~ What did you like or not like? What should we discuss next time? Let us know via a YouTube comment, on social media, or by commenting on our Google doc ! ~~~ Postgres FM is produced by: Michael Christofides, founder of pgMustard Nikolay Samokhvalov, founder of Postgres.ai With credit to: Jessie Draws for the elephant artwork ## Actions - request_transcript: `POST https://stenobird.com/v1/public/podcasts/postgres-fm-5565051/episodes/gapless-sequences/transcription-requests` — Idempotently request low-priority transcript generation for this episode. - read_markdown: `GET https://stenobird.com/podcast/postgres-fm-5565051/gapless-sequences.md` — Read the agent-friendly Markdown representation of this episode resource. A page view does not enqueue transcription. Agents should invoke `request_transcript` explicitly when they need this episode processed. ## Transcript Full transcripts are not published on public pages unless there is a clear rights basis.