Re: plan cache overhead on plpgsql expression
От
Tom Lane
Тема
Re: plan cache overhead on plpgsql expression
Дата
Msg-id
21695.1585256389@sss.pgh.pa.us
Ответ на
Re: plan cache overhead on plpgsql expression (Andres Freund)
Список
Дерево обсуждения
plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Amit Langote <amitlangote09@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Amit Langote <amitlangote09@gmail.com>
Re: plan cache overhead on plpgsql expression Amit Langote <amitlangote09@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Amit Langote <amitlangote09@gmail.com>
Re: plan cache overhead on plpgsql expression Amit Langote <amitlangote09@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Andres Freund <andres@anarazel.de>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Andres Freund <andres@anarazel.de>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Andres Freund <andres@anarazel.de>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Andres Freund <andres@anarazel.de>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Robert Haas <robertmhaas@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Amit Langote <amitlangote09@gmail.com>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Tom Lane <tgl@sss.pgh.pa.us>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Amit Langote <amitlangote09@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Re: plan cache overhead on plpgsql expression Amit Langote <amitlangote09@gmail.com>
Re: plan cache overhead on plpgsql expression David Steele <david@pgmasters.net>
Re: plan cache overhead on plpgsql expression Amit Langote <amitlangote09@gmail.com>
Re: plan cache overhead on plpgsql expression Pavel Stehule <pavel.stehule@gmail.com>
Andres Freund writes: > On 2020-03-26 14:37:59 -0400, Tom Lane wrote: >> Testing that reminded me of the other regression test failure I'd seen >> when I first tried to do it: select_parallel.sql shows a WARNING about >> a plancache leak in a parallel worker process. When I looked into the >> reason for that, it turned out that some cowboy has split >> XACT_EVENT_COMMIT into XACT_EVENT_COMMIT and >> XACT_EVENT_PARALLEL_COMMIT (where the latter is used in parallel >> workers) without bothering to fix the collateral damage to plpgsql. >> So plpgsql_xact_cb isn't doing any cleanup in parallel workers, and >> hasn't been for a couple of releases. >> The bad effects of that are probably limited given that the worker >> process will exit after committing, but I still think that that part >> of this patch is a bug fix that needs to be back-patched. > Ugh. Lucky that we don't register many things inside those resowners. Yeah. I spent some time trying to produce a failure this way, and concluded that it's pretty hard because most of the relevant callbacks will be run during ExprContext shutdown, which is done during plpgsql function exit. In a non-transaction-abort situation, the simple EState shouldn't have any live ExprContexts left at commit. I did find a case where a memory context callback attached to the EState's query context doesn't get run when expected ... but it still gets run later, when the whole memory context tree is destroyed. So I can't demonstrate any user-visible misbehavior in the core code. But it still seems like a prudent idea to back-patch a fix, in case I missed something or there is some extension that's pushing the boundaries further. It's definitely not very cool that we're leaving behind a dangling static pointer to an EState that won't exist once TopTransactionMemoryContext is gone. I'll back-patch relevant parts of those comments about DO block management, too. regards, tom lane
В списке pgsql-hackers по дате отправления