pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Adjust design of per-worker parallel seqscan data struct
Date: Mon, 29 Mar 2021 21:17:41 +0000
Message-ID: <E1lQzGX-0002mJ-FV@gemulon.postgresql.org> (raw)

Adjust design of per-worker parallel seqscan data struct

The design of the data structures which allow storage of the per-worker
memory during parallel seq scans were not ideal. The work done in
56788d215 required an additional data structure to allow workers to
remember the range of pages that had been allocated to them for
processing during a parallel seqscan.  That commit added a void pointer
field to TableScanDescData to allow heapam to store the per-worker
allocation information.  However putting the field there made very little
sense given that we have AM specific structs for that, e.g.
HeapScanDescData.

Here we remove the void pointer field from TableScanDescData and add a
dedicated field for this purpose to HeapScanDescData.

Previously we also allocated memory for this parallel per-worker data for
all scans, regardless if it was a parallel scan or not.  This was just a
wasted allocation for non-parallel scans, so here we make the allocation
conditional on the scan being parallel.

Also, add previously missing pfree() to free the per-worker data in
heap_endscan().

Reported-by: Andres Freund
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/20210317023101.anvejcfotwka6gaa@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/af527705edc3fd0b335264d17e0521c05edc5cca

Modified Files
--------------
src/backend/access/heap/heapam.c | 22 ++++++++++++++++------
src/include/access/heapam.h      |  6 ++++++
src/include/access/relscan.h     |  1 -
3 files changed, 22 insertions(+), 7 deletions(-)



Message-ID: <E1lQzGX-0002mJ-FV@gemulon.postgresql.org>
Permalink:  ../E1lQzGX-0002mJ-FV@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lQzGX-0002mJ-FV@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: drowley@postgresql.org
  Subject: Re: pgsql: Adjust design of per-worker parallel seqscan data struct
  In-Reply-To: <E1lQzGX-0002mJ-FV@gemulon.postgresql.org>
  References: <E1lQzGX-0002mJ-FV@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