On 2022-Jan-28, Andres Freund wrote: > > + foreach(lc, data->publications) > > + { > > + Publication *pub = lfirst(lc);
... > Isn't this basically O(schemas * publications)? Yeah, there are various places in the logical replication code that seem pretty careless about this kind of thing -- most of it seems to assume that there are going to be few publications, so it just looks things up over and over with abandon, and I saw at least one place where it looped up an inheritance hierarchy for partitioning doing indexscans at each level(*). I think a lot more thought is going to be required to fix these things in a thorough manner -- a log.repl.-specific caching mechanism, I imagine. (*) Before 025b920a3d45, psql was forced to seqscan pg_publication_rel for one of the describe.c queries, and nobody seems to have noticed. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ Y una voz del caos me habló y me dijo "Sonríe y sé feliz, podría ser peor". Y sonreí. Y fui feliz. Y fue peor.