On Thursday, March 19, 2020, Tom Lane <t...@sss.pgh.pa.us> wrote: > Michael Lewis <mle...@entrata.com> writes: > > On Thu, Mar 19, 2020, 5:48 PM David G. Johnston < > david.g.johns...@gmail.com> > > wrote: > >> However, one other consideration with sequences: do you care that > >> PostgreSQL will cache/pin (i.e., no release) every single sequence you > >> touch for the lifetime of the session? (I do not think DISCARD matters > here > >> but I'm just guessing) > > > Would you expand on this point or is there someplace specific in the > > documentation on this? > > I think what David is worried about is that a sequence object is a > one-row table in PG's implementation. Thus > > (1) each sequence requires a dozen or two rows in assorted system > catalogs (not sure exactly how many offhand). >
Actually I seemed to have missed that dynamic. I was actually referring to the SeqTable hash table specified here: https://github.com/postgres/postgres/blob/85f6b49c2c53fb1e08d918ec9305faac13cf7ad6/src/backend/commands/sequence.c#L69 I wouldn’t think there would be much spreading of data throughout the catalog if the sequences are unowned (by tables). David J.