Skip site navigation (1) Skip section navigation (2)

Representation of index clause lists

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Representation of index clause lists
Date: 2011-12-24 00:53:17
Message-ID: 16675.1324687997@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
No sooner had I committed e2c2c2e8b1df7dfdb01e7e6f6191a569ce3c3195 than
I started having second thoughts about the choice of representation.
The requirement is to tell which index column each potential index qual
is meant to be used with.  I used a list-of-sublists representation, in
which each sublist corresponds to an index column, because that's what
group_clauses_by_indexkey has historically produced.  But on reflection
that seems like a leftover Lisp hack more than it does a natural choice.
The alternative that comes to mind is to use a flat list of quals and a
parallel integer list of column numbers.  Places that need to track what
goes with what would chase both lists in parallel using forboth(), while
places that don't care could just ignore the integer list.

This would end up with a net savings of palloc overhead because we could
get rid of the assorted calls to flatten_clausegroups_list and
flatten_indexorderbys_list that are currently needed by code that
doesn't want to think about column correspondences.  And it just seems
a bit more natural.

The only downside I can think of is that amcostestimate functions would
need two more arguments, bringing us to the point where we need an
OidFunctionCall11 (!), or else do some more drastic restructuring like
passing them an IndexPath explicitly.  But the existing commit has
already effectively changed their API, so this doesn't seem like a
showstopper.

Thoughts either way?

			regards, tom lane

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2011-12-24 01:44:11
Subject: Re: patch: bytea_agg
Previous:From: Tomas VondraDate: 2011-12-23 23:51:30
Subject: Re: WIP: explain analyze with 'rows' but not timing

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group