Re: patch for geqo tweaks

From: Nathan Wagner <nw+pg(at)hydaspes(dot)if(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: patch for geqo tweaks
Date: 2015-11-06 17:56:31
Message-ID: 20151106175631.GA8543@granicus.if.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 06, 2015 at 11:19:00AM -0500, Tom Lane wrote:
> Nathan Wagner <nw+pg(at)hydaspes(dot)if(dot)org> writes:
> > I see you committed a modified version of my patch in commit
> > 59464bd6f928ad0da30502cbe9b54baec9ca2c69.
>
> > You changed the tour[0] to be hardcoded to 1, but it should be any
> > of the possible gene numbers from 0 to remainder.
>
> How so? The intent is to replace the first iteration of the
> Fisher-Yates loop, not the old loop. That iteration will certainly
> end by assigning 1 to tour[0], because it must choose j = i = 0.

You are correct. I got confused between reading the original code, my
patch, and your modified patch.

I wonder why the algorithm bothers with the first iteration at all, in
the case of an initialized array, it would just swap the first element
with itself. I must be missing something. I'll need to do some more
reading.

--
nw

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Wagner 2015-11-06 18:27:07 Re: patch for geqo tweaks
Previous Message Robert Haas 2015-11-06 17:53:56 Re: [BUGS] BUG #12989: pg_size_pretty with negative values