pgsql: Simplify and speed up mapping of index opfamilies to pathkeys.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Simplify and speed up mapping of index opfamilies to pathkeys.
Date: 2010-11-29 17:31:14
Message-ID: E1PN7ZK-0008IR-Dx@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Simplify and speed up mapping of index opfamilies to pathkeys.

Formerly we looked up the operators associated with each index (caching
them in relcache) and then the planner looked up the btree opfamily
containing such operators in order to build the btree-centric pathkey
representation that describes the index's sort order. This is quite
pointless for btree indexes: we might as well just use the index's opfamily
information directly. That saves syscache lookup cycles during planning,
and furthermore allows us to eliminate the relcache's caching of operators
altogether, which may help in reducing backend startup time.

I added code to plancat.c to perform the same type of double lookup
on-the-fly if it's ever faced with a non-btree amcanorder index AM.
If such a thing actually becomes interesting for production, we should
replace that logic with some more-direct method for identifying the
corresponding btree opfamily; but it's not worth spending effort on now.

There is considerably more to do pursuant to my recent proposal to get rid
of sort-operator-based representations of sort orderings, but this patch
grabs some of the low-hanging fruit. I'll look at the remainder of that
work after the current commitfest.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=c0b5fac7010fa3468577d3a90ee8783639500fed

Modified Files
--------------
src/backend/optimizer/path/indxpath.c | 2 +-
src/backend/optimizer/path/pathkeys.c | 137 +++++++++++++++++++-------------
src/backend/optimizer/util/plancat.c | 113 +++++++++++++++++----------
src/backend/utils/adt/selfuncs.c | 56 +++++++-------
src/backend/utils/cache/relcache.c | 137 +++++----------------------------
src/include/nodes/relation.h | 21 ++---
src/include/utils/rel.h | 9 +-
7 files changed, 217 insertions(+), 258 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Magnus Hagander 2010-11-29 18:58:39 Re: Re: [COMMITTERS] pgsql: Remove outdated comments from the regression test files.
Previous Message Robert Haas 2010-11-29 15:26:12 Re: Re: [COMMITTERS] pgsql: Remove outdated comments from the regression test files.