Re: Fix for seg picksplit function - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: Fix for seg picksplit function
Date
Msg-id AANLkTimL7-iLSfv23osE6WO-s9FQQNBq3vBnCbZ7DYVS@mail.gmail.com
Whole thread Raw
In response to Re: Fix for seg picksplit function  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Fix for seg picksplit function
List pgsql-hackers
On Tue, Nov 16, 2010 at 3:07 AM, Robert Haas <robertmhaas@gmail.com> wrote:
The loop that begins here:

   for (i = 0; i < maxoff; i++)
   {
       /* First half of segs goes to the left datum. */
       if (i < seed_2)

...looks like it should perhaps be broken into two separate loops.
That might also help tweak the logic in a way that eliminates this:

seg.c: In function ‘gseg_picksplit’:
seg.c:327: warning: ‘datum_r’ may be used uninitialized in this function
seg.c:326: warning: ‘datum_l’ may be used uninitialized in this function
I restored original version of that loop.
 
But on a broader note, I'm not very certain the sorting algorithm is
sensible.  For example, suppose you have 10 segments that are exactly
'0' and 20 segments that are exactly '1'.  Maybe I'm misunderstanding,
but it seems like this will result in a 15/15 split when we almost
certainly want a 10/20 split.  I think there will be problems in more
complex cases as well.  The documentation says about the less-than and
greater-than operators that "These operators do not make a lot of
sense for any practical purpose but sorting."
I think almost any split algorithm has corner cases when it's results don't look very good. I think the way to understand significance of these corner cases for real life is to perform sufficient testing on datasets which is close to real life. I'm not feeling power to propose enough of test datasets and estimate their significance for real life cases, and I need help in this field.

----
With best regards,
Alexander Korotkov. 
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Improved parallel make support
Next
From: Shigeru HANADA
Date:
Subject: Re: SQL/MED estimated time of arrival?