pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove redundant snapshot copying from parallel leader to worker
Date: Thu, 14 Mar 2024 13:32:00 +0000
Message-ID: <E1rklBg-003ldt-K7@gemulon.postgresql.org> (raw)

Remove redundant snapshot copying from parallel leader to workers

The parallel query infrastructure copies the leader backend's active
snapshot to the worker processes. But BitmapHeapScan node also had
bespoken code to pass the snapshot from leader to the worker. That was
redundant, so remove it.

The removed code was analogous to the snapshot serialization in
table_parallelscan_initialize(), but that was the wrong role model. A
parallel bitmap heap scan is more like an independent non-parallel
bitmap heap scan in each parallel worker as far as the table AM is
concerned, because the coordination is done in nodeBitmapHeapscan.c,
and the table AM doesn't need to know anything about it.

This relies on the assumption that es_snapshot ==
GetActiveSnapshot(). That's not a new assumption, things would get
weird if you used the QueryDesc's snapshot for visibility checks in
the scans, but the active snapshot for evaluating quals, for
example. This could use some refactoring and cleanup, but for now,
just add some assertions.

Reviewed-by: Dilip Kumar, Robert Haas
Discussion: https://www.postgresql.org/message-id/5f3b9d59-0f43-419d-80ca-6d04c07cf61a@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/84c18acaf690e438e953e387caf1c13298d4ecb4

Modified Files
--------------
src/backend/access/table/tableam.c        | 10 ----------
src/backend/executor/execMain.c           |  6 ++++++
src/backend/executor/execParallel.c       |  7 +++++++
src/backend/executor/nodeBitmapHeapscan.c | 17 ++---------------
src/include/access/tableam.h              |  5 -----
src/include/nodes/execnodes.h             |  4 ----
6 files changed, 15 insertions(+), 34 deletions(-)



Message-ID: <E1rklBg-003ldt-K7@gemulon.postgresql.org>
Permalink:  ../E1rklBg-003ldt-K7@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rklBg-003ldt-K7@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove redundant snapshot copying from parallel leader to worker
  In-Reply-To: <E1rklBg-003ldt-K7@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