Commit 48beecda authored by Tom Lane's avatar Tom Lane

Remove geqo_random_seed parameter. Having geqo reset the global random()

sequence every time it's called is bogus --- it interferes with user
control over the seed, and actually decreases randomness overall
(because a seed based on time(NULL) is pretty predictable).  If you really
want a reproducible result from geqo, do 'set seed = 0' before planning
a query.
parent 75c35e0f
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.203 2003/09/05 16:13:38 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.204 2003/09/07 15:26:45 tgl Exp $
-->
<Chapter Id="runtime">
......@@ -1438,7 +1438,6 @@ SET ENABLE_SEQSCAN TO OFF;
<term><varname>GEQO_EFFORT</varname> (<type>integer</type>)</term>
<term><varname>GEQO_GENERATIONS</varname> (<type>integer</type>)</term>
<term><varname>GEQO_POOL_SIZE</varname> (<type>integer</type>)</term>
<term><varname>GEQO_RANDOM_SEED</varname> (<type>integer</type>)</term>
<term><varname>GEQO_SELECTION_BIAS</varname> (<type>floating point</type>)</term>
<listitem>
<para>
......@@ -1455,9 +1454,7 @@ SET ENABLE_SEQSCAN TO OFF;
is roughly proportional to the sum of pool size and generations.
The selection bias is the selective pressure within the
population. Values can be from 1.50 to 2.00; the latter is the
default. The random seed can be set to get reproducible results
from the algorithm. If it is set to -1 then the algorithm
behaves non-deterministically.
default.
</para>
</listitem>
</varlistentry>
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.39 2003/08/12 18:23:20 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.40 2003/09/07 15:26:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -41,7 +41,6 @@ int Geqo_pool_size;
int Geqo_effort;
int Geqo_generations;
double Geqo_selection_bias;
int Geqo_random_seed;
static int gimme_pool_size(int nr_rel);
......@@ -96,13 +95,6 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
number_generations = gimme_number_generations(pool_size, Geqo_effort);
status_interval = 10;
/* seed random number generator */
/* XXX why is this done every time around? */
if (Geqo_random_seed >= 0)
srandom((unsigned int) Geqo_random_seed);
else
srandom((unsigned int) time(NULL));
/* allocate genetic pool memory */
pool = alloc_pool(pool_size, number_of_rels);
......
......@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.155 2003/09/04 05:11:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.156 2003/09/07 15:26:53 tgl Exp $
*
*--------------------------------------------------------------------
*/
......@@ -898,15 +898,6 @@ static struct config_int ConfigureNamesInt[] =
&Geqo_generations,
0, 0, INT_MAX, NULL, NULL
},
{
{"geqo_random_seed", PGC_USERSET, QUERY_TUNING_GEQO,
gettext_noop("Can be set to get reproducible results from the algorithm"),
gettext_noop("If it is set to -1 then the algorithm behaves "
"non-deterministically")
},
&Geqo_random_seed,
-1, INT_MIN, INT_MAX, NULL, NULL
},
{
{"deadlock_timeout", PGC_SIGHUP, LOCK_MANAGEMENT,
......
......@@ -121,7 +121,6 @@
#geqo_generations = 0
#geqo_pool_size = 0 # default based on tables in statement,
# range 128-1024
#geqo_random_seed = -1 # -1 = use variable seed
#geqo_selection_bias = 2.0 # range 1.5-2.0
# - Other Planner Options -
......
......@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.84 2003/08/04 23:59:40 tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.85 2003/09/07 15:26:54 tgl Exp $
*/
/*----------------------------------------------------------------------
......@@ -534,7 +534,6 @@ psql_completion(char *text, int start, int end)
"geqo_effort",
"geqo_generations",
"geqo_pool_size",
"geqo_random_seed",
"geqo_selection_bias",
"geqo_threshold",
"join_collapse_limit",
......
......@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo.h,v 1.31 2003/08/04 02:40:13 momjian Exp $
* $Id: geqo.h,v 1.32 2003/09/07 15:26:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -64,8 +64,6 @@ extern double Geqo_selection_bias;
#define MIN_GEQO_SELECTION_BIAS 1.5
#define MAX_GEQO_SELECTION_BIAS 2.0
extern int Geqo_random_seed; /* or negative to use current time */
/* routines in geqo_main.c */
extern RelOptInfo *geqo(Query *root, int number_of_rels, List *initial_rels);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment