Hi Nik, On Tue, Sep 15, 2026 at 6:01 PM Nikolay Samokhvalov <[email protected]> wrote: > > Here's the reproducer for the retained flush contexts. Run it in a fresh > superuser session on master ceae3099. > > begin; > create temp table p (k int primary key); > create temp table c (k int references p); > insert into p values (1); > do $$ > begin > for i in 1..1000 loop begin > insert into c > select case when g = 64 then 2 else 1 end > from generate_series(1, 64) g; > raise exception 'insert unexpectedly succeeded'; > exception when foreign_key_violation then null; > end; end loop; > end > $$; > select count(*) as contexts, coalesce(sum(total_bytes), 0) as bytes > from pg_backend_memory_contexts > where name = 'RI fast path flush temporary context'; > rollback; > > Before rollback, I get 1000 contexts / 16384000 bytes without the patch, > and 0 / 0 with it.
Thanks for the report. I'm adding this to my list of batching issues to fix in the master, along with the patches I posted upthread on Sep 4. -- Thanks, Amit Langote
