Re: Speed up transaction completion faster after many relations are accessed in a transaction
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: David Rowley <dgrowleyml@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>, Jacob Champion
<jchampion@timescale.com>, Yura Sokolov <y.sokolov@postgrespro.ru>,
Zhihong Yu <zyu@yugabyte.com>, Michael Paquier <michael@paquier.xyz>,
"pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>,
Tom Lane <tgl@sss.pgh.pa.us>,
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>,
"Imai, Yoshikazu" <imai.yoshikazu@jp.fujitsu.com>,
Andres Freund <andres@anarazel.de>, Simon Riggs <simon@2ndquadrant.com>,
Amit Langote <amitlangote09@gmail.com>
Date: 2023-09-15T10:37:11Z
Lists: pgsql-hackers
On 11/09/2023 15:00, David Rowley wrote: > On Wed, 5 Jul 2023 at 21:44, Heikki Linnakangas <hlinnaka@iki.fi> wrote: >> >>> index 296dc82d2ee..edb8b6026e5 100644 >>> --- a/src/backend/commands/discard.c >>> +++ b/src/backend/commands/discard.c >>> @@ -71,7 +71,7 @@ DiscardAll(bool isTopLevel) >>> Async_UnlistenAll(); >>> - LockReleaseAll(USER_LOCKMETHOD, true); >>> + LockReleaseSession(USER_LOCKMETHOD); >>> ResetPlanCache(); >> >> This assumes that there are no transaction-level advisory locks. I think >> that's OK. It took me a while to convince myself of that, though. I >> think we need a high level comment somewhere that explains what >> assumptions we make on which locks can be held in session mode and which >> in transaction mode. > > Isn't it ok because DISCARD ALL cannot run inside a transaction block, > so there should be no locks taken apart from possibly session-level > locks? Hmm, sounds valid. I think I convinced myself that it's OK through some other reasoning, but I don't remember it now. > I've added a call to LockAssertNoneHeld(false) in there. I don't see it in the patch? -- Heikki Linnakangas Neon (https://neon.tech)
Commits
-
Reorder LOCALLOCK structure members to compact the size
- 28988a84cf19 12.0 landed
-
Be more careful to not lose sync in the FE/BE protocol.
- 2b3a8b20c2da 9.5.0 cited