pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve performance of index-only scans with many index columns.
Date: Sun, 03 Mar 2019 21:57:20 +0000
Message-ID: <E1h0Z6m-0005MK-SW@gemulon.postgresql.org> (raw)

Improve performance of index-only scans with many index columns.

StoreIndexTuple was a loop over index_getattr, which is O(N^2)
if the index columns are variable-width, and the performance
impact is already quite visible at ten columns.  The obvious
move is to replace that with a call to index_deform_tuple ...
but that's *also* a loop over index_getattr.  Improve it to
be essentially a clone of heap_deform_tuple.

(There are a few other places that loop over all index columns
with index_getattr, and perhaps should be changed likewise,
but most of them don't seem performance-critical.  Anyway, the
rest would mostly only be interested in the index key columns,
which there aren't likely to be so many of.  Wide index tuples
are a new thing with INCLUDE.)

Konstantin Knizhnik

Discussion: https://postgr.es/m/e06b2d27-04fc-5c0e-bb8c-ecd72aa24959@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/80b9e9c4664a020ebd14889046bd8d22a17d1ca6

Modified Files
--------------
src/backend/access/common/indextuple.c   | 69 ++++++++++++++++++++++++++++++--
src/backend/executor/nodeIndexonlyscan.c | 20 ++++-----
2 files changed, 72 insertions(+), 17 deletions(-)



Message-ID: <E1h0Z6m-0005MK-SW@gemulon.postgresql.org>
Permalink:  ../E1h0Z6m-0005MK-SW@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1h0Z6m-0005MK-SW@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Improve performance of index-only scans with many index columns.
  In-Reply-To: <E1h0Z6m-0005MK-SW@gemulon.postgresql.org>
  References: <E1h0Z6m-0005MK-SW@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