From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Speed up plpgsql trigger startup by introducing "promises".
Date: Wed, 14 Feb 2018 00:20:42 +0000
Message-ID: <E1elkoU-0002Bk-Ka@gemulon.postgresql.org> (raw)
Speed up plpgsql trigger startup by introducing "promises".
Over the years we've accreted quite a few special variables that are
predefined in plpgsql trigger functions. The cost of initializing these
variables to their defined values turns out to be a significant part of
the runtime of simple triggers; but, undoubtedly, most real-world triggers
never examine the values of most of these variables.
To improve matters, invent the notion of a variable that has a "promise"
attached to it, specifying which of the predetermined values should be
assigned to the variable if anything ever reads it. This eliminates all
the unneeded startup overhead, in return for a small penalty on accesses
to these variables.
Tom Lane, reviewed by Pavel Stehule
Discussion: https://postgr.es/m/11986.1514407114@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/fd333bc763ea104f2a2c10c6b0061c996d4a2f5a
Modified Files
--------------
src/pl/plpgsql/src/pl_comp.c | 50 +++++--
src/pl/plpgsql/src/pl_exec.c | 334 +++++++++++++++++++++++++++---------------
src/pl/plpgsql/src/pl_funcs.c | 5 +
src/pl/plpgsql/src/pl_gram.y | 3 +
src/pl/plpgsql/src/plpgsql.h | 56 +++++--
5 files changed, 306 insertions(+), 142 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Speed up plpgsql trigger startup by introducing "promises".
In-Reply-To: <E1elkoU-0002Bk-Ka@gemulon.postgresql.org>
References: <E1elkoU-0002Bk-Ka@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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