pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Remove unnecessary PG_TRY overhead for CurrentResourceOwner chan
2+ messages / 1 participants
[nested] [flat]

* pgsql: Remove unnecessary PG_TRY overhead for CurrentResourceOwner chan
@ 2017-10-11 21:44  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Tom Lane @ 2017-10-11 21:44 UTC (permalink / raw)
  To: pgsql-committers

Remove unnecessary PG_TRY overhead for CurrentResourceOwner changes.

resowner/README contained advice to use a PG_TRY block to restore the
old CurrentResourceOwner value anywhere that that variable is transiently
changed.  That advice was only inconsistently followed, however, and
on reflection it seems like unnecessary overhead.  We don't bother
with such a convention for transient CurrentMemoryContext changes,
on the grounds that any (sub)transaction abort will start out by
resetting CurrentMemoryContext to what it wants.  But the same is
true of CurrentResourceOwner, so there seems no need to treat it
differently.

Hence, remove PG_TRY blocks that exist only to restore CurrentResourceOwner
before re-throwing the error.  There are a couple of places that restore
it along with some other actions, and I left those alone; the restore is
probably unnecessary but no noticeable gain will result from removing it.

Discussion: https://postgr.es/m/5236.1507583529@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5fa6b0d102eb8ccd15c4963ee9841baec50df45e

Modified Files
--------------
src/backend/access/transam/xact.c          | 16 +++--------
src/backend/commands/portalcmds.c          | 22 +++++----------
src/backend/commands/sequence.c            | 16 +++--------
src/backend/commands/trigger.c             | 36 ++++++++----------------
src/backend/storage/large_object/inv_api.c | 44 +++++++++---------------------
src/backend/utils/resowner/README          |  4 ---
src/backend/utils/resowner/resowner.c      | 20 ++------------
7 files changed, 42 insertions(+), 116 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: Remove unnecessary PG_TRY overhead for CurrentResourceOwner chan
@ 2017-10-11 21:47  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2017-10-11 21:47 UTC (permalink / raw)
  To: pgsql-committers

I wrote:
> Remove unnecessary PG_TRY overhead for CurrentResourceOwner changes.

> Discussion: https://postgr.es/m/5236.1507583529@sss.pgh.pa.us

Ooops, copied and pasted the wrong message ID.  The correct one is
Discussion: https://postgr.es/m/19645.1507568323@sss.pgh.pa.us

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-10-11 21:47 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11 21:44 pgsql: Remove unnecessary PG_TRY overhead for CurrentResourceOwner chan Tom Lane <tgl@sss.pgh.pa.us>
2017-10-11 21:47 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox