pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Inline plpgsql's exec_stmt() into exec_stmts().
Date: Fri, 03 Jul 2020 19:42:16 +0000
Message-ID: <E1jrRZg-0003l2-0u@gemulon.postgresql.org> (raw)

Inline plpgsql's exec_stmt() into exec_stmts().

This saves one level of C function call per plpgsql statement executed,
and permits a tiny additional optimization of not saving and restoring
estate->err_stmt for each statement in a block.  The net effect seems
nearly un-measurable on x86_64, but there's a clear win on aarch64,
amounting to two or three percent in a loop over a few simple plpgsql
statements.

To do this, we have to get rid of the other existing call sites for
exec_stmt().  Replace them with exec_toplevel_block(), which is just
defined to do what exec_stmts() does, but for a single
PLpgSQL_stmt_block statement.  Hard-wiring the expectation of which
statement type applies here allows us to skip the dispatch switch,
making this not much uglier than the previous factorization.

Amit Khandekar, tweaked a bit by me

Discussion: https://postgr.es/m/CAJ3gD9eBNrmUD7WBBLG8ohaZ485H9y+4eihQTgr+K8Lhka3vcQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1f902d499eda862a98e881a2227b8d2cf3565374

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 280 +++++++++++++++++++++++--------------------
1 file changed, 147 insertions(+), 133 deletions(-)



Message-ID: <E1jrRZg-0003l2-0u@gemulon.postgresql.org>
Permalink:  ../E1jrRZg-0003l2-0u@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jrRZg-0003l2-0u@gemulon.postgresql.org

 · 

reply

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: Inline plpgsql's exec_stmt() into exec_stmts().
  In-Reply-To: <E1jrRZg-0003l2-0u@gemulon.postgresql.org>
  References: <E1jrRZg-0003l2-0u@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