From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Allow index AMs to return either HeapTuple or IndexTuple format
Date: Mon, 27 Feb 2017 22:22:41 +0000
Message-ID: <E1ciTgn-0008RG-Hg@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Allow index AMs to return either HeapTuple or IndexTuple format during IOS.
Previously, only IndexTuple format was supported for the output data of
an index-only scan. This is fine for btree, which is just returning a
verbatim index tuple anyway. It's not so fine for SP-GiST, which can
return reconstructed data that's much larger than a page.
To fix, extend the index AM API so that index-only scan data can be
returned in either HeapTuple or IndexTuple format. There's other ways
we could have done it, but this way avoids an API break for index AMs
that aren't concerned with the issue, and it costs little except a couple
more fields in IndexScanDescs.
I changed both GiST and SP-GiST to use the HeapTuple method. I'm not
very clear on whether GiST can reconstruct data that's too large for an
IndexTuple, but that seems possible, and it's not much of a code change to
fix.
Per a complaint from Vik Fearing. Reviewed by Jason Li.
Discussion: https://postgr.es/m/49527f79-530d-0bfe-3dad-d183596afa92@2ndquadrant.fr
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/9b88f27cb42fe8ff59ddc75e29c005624b8850a2
Modified Files
--------------
doc/src/sgml/indexam.sgml | 16 ++++++++++------
src/backend/access/gist/gistget.c | 17 +++++++++--------
src/backend/access/gist/gistscan.c | 5 +++--
src/backend/access/gist/gistutil.c | 6 +++---
src/backend/access/index/genam.c | 2 ++
src/backend/access/index/indexam.c | 4 ++--
src/backend/access/spgist/spgscan.c | 24 ++++++++++++------------
src/backend/executor/nodeIndexonlyscan.c | 21 +++++++++++++++++++--
src/include/access/gist_private.h | 4 ++--
src/include/access/relscan.h | 9 ++++++++-
src/include/access/spgist_private.h | 2 +-
11 files changed, 71 insertions(+), 39 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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: Allow index AMs to return either HeapTuple or IndexTuple format
In-Reply-To: <E1ciTgn-0008RG-Hg@gemulon.postgresql.org>
References: <E1ciTgn-0008RG-Hg@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