pgsql: Further cleanup of gistsplit.c.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Further cleanup of gistsplit.c.
Date: 2013-02-10 21:22:11
Message-ID: E1U4eLj-0006Ok-A4@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Further cleanup of gistsplit.c.

After further reflection I was unconvinced that the existing coding is
guaranteed to return valid union datums in every code path for multi-column
indexes. Fix that by forcing a gistunionsubkey() call at the end of the
recursion. Having done that, we can remove some clearly-redundant calls
elsewhere. This should be a little faster for multi-column indexes (since
the previous coding would uselessly do such a call for each column while
unwinding the recursion), as well as much harder to break.

Also, simplify the handling of cases where one side or the other of a
primary split contains only don't-care tuples. The previous coding used a
very ugly hack in removeDontCares() that essentially forced one random
tuple to be treated as non-don't-care, providing a random initial choice of
seed datum for the secondary split. It seems unlikely that that method
will give better-than-random splits. Instead, treat such a split as
degenerate and just let the next column determine the split, the same way
that we handle fully degenerate cases where the two sides produce identical
union datums.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c352ea2d74c4e317bf2a1471ec1f750f9f072276

Modified Files
--------------
src/backend/access/gist/gistsplit.c | 157 +++++++++++++++++++++--------------
1 files changed, 93 insertions(+), 64 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-02-11 16:16:52 pgsql: Include previous TLI in end-of-recovery and shutdown checkpoint
Previous Message Tom Lane 2013-02-10 18:08:27 pgsql: Remove useless picksplit-doesn't-support-secondary-split log spa