pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Allow avoiding tuple copy within tuplesort_gettupleslot().
Date: Thu, 06 Apr 2017 21:50:02 +0000
Message-ID: <E1cwFI2-0002a2-QN@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Allow avoiding tuple copy within tuplesort_gettupleslot().

Add a "copy" argument to make it optional to receive a copy of caller
tuple that is safe to use following a subsequent manipulating of
tuplesort's state.  This is a performance optimization.  Most existing
tuplesort_gettupleslot() callers are made to opt out of copying.
Existing callers that happen to rely on the validity of tuple memory
beyond subsequent manipulations of the tuplesort request their own
copy.

This brings tuplesort_gettupleslot() in line with
tuplestore_gettupleslot().  In the future, a "copy"
tuplesort_getdatum() argument may be added, that similarly allows
callers to opt out of receiving their own copy of tuple.

In passing, clarify assumptions that callers of other tuplesort fetch
routines may make about tuple memory validity, per gripe from Tom
Lane.

Author: Peter Geoghegan
Discussion: CAM3SWZQWZZ_N=DmmL7tKy_OUjGH_5mN=N=A6h7kHyyDvEhg2DA@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/fa117ee40330db401da776e7b003f047098a7d4c

Modified Files
--------------
src/backend/executor/nodeAgg.c         |  9 ++++++---
src/backend/executor/nodeSort.c        |  5 +++--
src/backend/utils/adt/orderedsetaggs.c |  5 +++--
src/backend/utils/sort/tuplesort.c     | 28 +++++++++++++++++-----------
src/include/utils/tuplesort.h          |  2 +-
5 files changed, 30 insertions(+), 19 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1cwFI2-0002a2-QN@gemulon.postgresql.org>
Permalink:  ../E1cwFI2-0002a2-QN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cwFI2-0002a2-QN@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: andres@anarazel.de
  Subject: Re: pgsql: Allow avoiding tuple copy within tuplesort_gettupleslot().
  In-Reply-To: <E1cwFI2-0002a2-QN@gemulon.postgresql.org>
  References: <E1cwFI2-0002a2-QN@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