Обсуждение: pgsql: Remove redundant snapshot copying from parallel leader to worker

Поиск
Список
Период
Сортировка

pgsql: Remove redundant snapshot copying from parallel leader to worker

От
Heikki Linnakangas
Дата:
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(-)