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: In the executor, use an array of pointers to access the rangetab
Date: Thu, 04 Oct 2018 19:48:23 +0000
Message-ID: <E1g89bj-0003Wq-K5@gemulon.postgresql.org> (raw)

In the executor, use an array of pointers to access the rangetable.

Instead of doing a lot of list_nth() accesses to es_range_table,
create a flattened pointer array during executor startup and index
into that to get at individual RangeTblEntrys.

This eliminates one source of O(N^2) behavior with lots of partitions.
(I'm not exactly convinced that it's the most important source, but
it's an easy one to fix.)

Amit Langote and David Rowley

Discussion: https://postgr.es/m/468c85d9-540e-66a2-1dde-fec2b741e688@lab.ntt.co.jp

Branch
------
master

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

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c      | 12 ++++----
src/backend/commands/copy.c              |  5 ++--
src/backend/commands/trigger.c           |  2 +-
src/backend/executor/execExprInterp.c    |  6 ++--
src/backend/executor/execMain.c          | 34 +++++++++-------------
src/backend/executor/execUtils.c         | 49 +++++++++++++++++++++++++++++---
src/backend/executor/nodeLockRows.c      |  2 +-
src/backend/replication/logical/worker.c |  3 +-
src/include/executor/executor.h          |  9 ++++++
src/include/nodes/execnodes.h            |  7 +++--
src/include/parser/parsetree.h           | 10 -------
11 files changed, 87 insertions(+), 52 deletions(-)



Message-ID: <E1g89bj-0003Wq-K5@gemulon.postgresql.org>
Permalink:  ../E1g89bj-0003Wq-K5@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1g89bj-0003Wq-K5@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: In the executor, use an array of pointers to access the rangetab
  In-Reply-To: <E1g89bj-0003Wq-K5@gemulon.postgresql.org>
  References: <E1g89bj-0003Wq-K5@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