Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit48beecd

Browse files
committed
Remove geqo_random_seed parameter. Having geqo reset the global random()
sequence every time it's called is bogus --- it interferes with usercontrol over the seed, and actually decreases randomness overall(because a seed based on time(NULL) is pretty predictable). If you reallywant a reproducible result from geqo, do 'set seed = 0' before planninga query.
1 parent75c35e0 commit48beecd

File tree

6 files changed

+6
-30
lines changed

6 files changed

+6
-30
lines changed

‎doc/src/sgml/runtime.sgml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.203 2003/09/05 16:13:38 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.204 2003/09/07 15:26:45 tgl Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -1438,7 +1438,6 @@ SET ENABLE_SEQSCAN TO OFF;
14381438
<term><varname>GEQO_EFFORT</varname> (<type>integer</type>)</term>
14391439
<term><varname>GEQO_GENERATIONS</varname> (<type>integer</type>)</term>
14401440
<term><varname>GEQO_POOL_SIZE</varname> (<type>integer</type>)</term>
1441-
<term><varname>GEQO_RANDOM_SEED</varname> (<type>integer</type>)</term>
14421441
<term><varname>GEQO_SELECTION_BIAS</varname> (<type>floating point</type>)</term>
14431442
<listitem>
14441443
<para>
@@ -1455,9 +1454,7 @@ SET ENABLE_SEQSCAN TO OFF;
14551454
is roughly proportional to the sum of pool size and generations.
14561455
The selection bias is the selective pressure within the
14571456
population. Values can be from 1.50 to 2.00; the latter is the
1458-
default. The random seed can be set to get reproducible results
1459-
from the algorithm. If it is set to -1 then the algorithm
1460-
behaves non-deterministically.
1457+
default.
14611458
</para>
14621459
</listitem>
14631460
</varlistentry>

‎src/backend/optimizer/geqo/geqo_main.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.39 2003/08/12 18:23:20 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.40 2003/09/07 15:26:52 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -41,7 +41,6 @@ intGeqo_pool_size;
4141
intGeqo_effort;
4242
intGeqo_generations;
4343
doubleGeqo_selection_bias;
44-
intGeqo_random_seed;
4544

4645

4746
staticintgimme_pool_size(intnr_rel);
@@ -96,13 +95,6 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
9695
number_generations=gimme_number_generations(pool_size,Geqo_effort);
9796
status_interval=10;
9897

99-
/* seed random number generator */
100-
/* XXX why is this done every time around? */
101-
if (Geqo_random_seed >=0)
102-
srandom((unsignedint)Geqo_random_seed);
103-
else
104-
srandom((unsignedint)time(NULL));
105-
10698
/* allocate genetic pool memory */
10799
pool=alloc_pool(pool_size,number_of_rels);
108100

‎src/backend/utils/misc/guc.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.155 2003/09/04 05:11:20 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.156 2003/09/07 15:26:53 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -898,15 +898,6 @@ static struct config_int ConfigureNamesInt[] =
898898
&Geqo_generations,
899899
0,0,INT_MAX,NULL,NULL
900900
},
901-
{
902-
{"geqo_random_seed",PGC_USERSET,QUERY_TUNING_GEQO,
903-
gettext_noop("Can be set to get reproducible results from the algorithm"),
904-
gettext_noop("If it is set to -1 then the algorithm behaves "
905-
"non-deterministically")
906-
},
907-
&Geqo_random_seed,
908-
-1,INT_MIN,INT_MAX,NULL,NULL
909-
},
910901

911902
{
912903
{"deadlock_timeout",PGC_SIGHUP,LOCK_MANAGEMENT,

‎src/backend/utils/misc/postgresql.conf.sample

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@
121121
#geqo_generations = 0
122122
#geqo_pool_size = 0# default based on tables in statement,
123123
# range 128-1024
124-
#geqo_random_seed = -1# -1 = use variable seed
125124
#geqo_selection_bias = 2.0# range 1.5-2.0
126125

127126
# - Other Planner Options -

‎src/bin/psql/tab-complete.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.84 2003/08/04 23:59:40 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.85 2003/09/07 15:26:54 tgl Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -534,7 +534,6 @@ psql_completion(char *text, int start, int end)
534534
"geqo_effort",
535535
"geqo_generations",
536536
"geqo_pool_size",
537-
"geqo_random_seed",
538537
"geqo_selection_bias",
539538
"geqo_threshold",
540539
"join_collapse_limit",

‎src/include/optimizer/geqo.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: geqo.h,v 1.31 2003/08/04 02:40:13 momjian Exp $
9+
* $Id: geqo.h,v 1.32 2003/09/07 15:26:54 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -64,8 +64,6 @@ extern double Geqo_selection_bias;
6464
#defineMIN_GEQO_SELECTION_BIAS 1.5
6565
#defineMAX_GEQO_SELECTION_BIAS 2.0
6666

67-
externintGeqo_random_seed;/* or negative to use current time */
68-
6967

7068
/* routines in geqo_main.c */
7169
externRelOptInfo*geqo(Query*root,intnumber_of_rels,List*initial_rels);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp