pgsql: Simplify the planner's new representation of indexable clauses a

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Simplify the planner's new representation of indexable clauses a
Date: 2019-02-15 00:37:36
Message-ID: E1guRVY-00088b-51@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Simplify the planner's new representation of indexable clauses a little.

In commit 1a8d5afb0, I thought it'd be a good idea to define
IndexClause.indexquals as NIL in the most common case where the given
clause (IndexClause.rinfo) is usable exactly as-is. It'd be more
consistent to define the indexquals in that case as being a one-element
list containing IndexClause.rinfo, but I thought saving the palloc
overhead for making such a list would be worthwhile.

In hindsight, that was a great example of "premature optimization is the
root of all evil": it's complicated everyplace that needs to deal with
the indexquals, requiring duplicative code to handle both the simple
case and the not-simple case. I'd initially found that tolerable but
it's getting less so as I mop up some areas that I'd not touched in
1a8d5afb0. In any case, two more pallocs during a planner run are
surely at the noise level (a conclusion confirmed by a bit of
microbenchmarking). So let's change this decision before it becomes
set in stone, and insist that IndexClause.indexquals always be a valid
list of the actual index quals for the clause.

Discussion: https://postgr.es/m/24586.1550106354@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8fd3fdd85a3e22f04b2cb0949450f63cb48952cd

Modified Files
--------------
src/backend/optimizer/path/indxpath.c | 8 +--
src/backend/optimizer/plan/createplan.c | 30 ++-------
src/backend/utils/adt/selfuncs.c | 112 ++++++++++++--------------------
src/include/nodes/pathnodes.h | 26 +++-----
4 files changed, 61 insertions(+), 115 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2019-02-15 02:05:34 pgsql: Fix race in dsm_attach() when handles are reused.
Previous Message Peter Eisentraut 2019-02-14 20:04:18 pgsql: Get rid of another unconstify through API changes