Alexander Korotkov escribió:
> > 4. It looks like the randomization is happening while trying to compare
> > the penalties. I think it may be more readable to separate those two
> > steps; e.g.
> >
> > /* create a mapping whether randomization is on or not */
> > for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
> > offsets[i - FirstOffsetNumber] = i;
> >
> > if (randomization)
> > /* randomize offsets array */
> >
> > for (i = 0; i < maxoff; i++)
> > {
> > offset = offsets[i];
> > ...
> > }
> >
> > That's just an idea; if you think it's more readable as-is (or if I am
> > misunderstanding) then let me know.
>
> Actually, current implementation comes from idea of creating possible less
> overhead when randomization is off. I'll try to measure overhead in worst
> case. If it is low enough then you proposal looks reasonable to me.
Were you able to do these measurements? If not, I'll defer to your and
Jeff's judgement on what's the best next step here.
Jeff, do you think we need more review of this patch?
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services