Skip site navigation (1) Skip section navigation (2)

pgsql: Make GEQO's planning deterministic by having it start from a

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make GEQO's planning deterministic by having it start from a
Date: 2009-07-16 20:55:45
Message-ID: 20090716205545.0B7F075331E@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Make GEQO's planning deterministic by having it start from a predictable
random number seed each time.  This is how it used to work years ago, but
we got rid of the seed reset because it was resetting the main random()
sequence and thus having undesirable effects on the rest of the system.
To fix, establish a private random number state for each execution of
geqo(), and initialize the state using the new GUC variable geqo_seed.
People who want to experiment with different random searches can do so
by changing geqo_seed, but you'll always get the same plan for the same
value of geqo_seed (if holding all other planner inputs constant, of course).

The new state is kept in PlannerInfo by adding a "void *" field reserved
for use by join_search hooks.  Most of the rather bulky code changes in
this commit are just arranging to pass PlannerInfo around to all the GEQO
functions (many of which formerly didn't receive it).

Andres Freund, with some editorialization by Tom

Modified Files:
--------------
    pgsql/doc/src/sgml:
        config.sgml (r1.221 -> r1.222)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/config.sgml?r1=1.221&r2=1.222)
        geqo.sgml (r1.40 -> r1.41)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/geqo.sgml?r1=1.40&r2=1.41)
    pgsql/src/backend/optimizer/geqo:
        Makefile (r1.20 -> r1.21)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/Makefile?r1=1.20&r2=1.21)
        geqo_copy.c (r1.19 -> r1.20)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_copy.c?r1=1.19&r2=1.20)
        geqo_cx.c (r1.10 -> r1.11)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_cx.c?r1=1.10&r2=1.11)
        geqo_erx.c (r1.20 -> r1.21)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_erx.c?r1=1.20&r2=1.21)
        geqo_eval.c (r1.88 -> r1.89)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_eval.c?r1=1.88&r2=1.89)
        geqo_main.c (r1.56 -> r1.57)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_main.c?r1=1.56&r2=1.57)
        geqo_mutation.c (r1.9 -> r1.10)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_mutation.c?r1=1.9&r2=1.10)
        geqo_ox1.c (r1.9 -> r1.10)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_ox1.c?r1=1.9&r2=1.10)
        geqo_ox2.c (r1.10 -> r1.11)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_ox2.c?r1=1.10&r2=1.11)
        geqo_pmx.c (r1.10 -> r1.11)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_pmx.c?r1=1.10&r2=1.11)
        geqo_pool.c (r1.33 -> r1.34)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_pool.c?r1=1.33&r2=1.34)
        geqo_px.c (r1.10 -> r1.11)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_px.c?r1=1.10&r2=1.11)
        geqo_recombination.c (r1.15 -> r1.16)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_recombination.c?r1=1.15&r2=1.16)
        geqo_selection.c (r1.24 -> r1.25)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_selection.c?r1=1.24&r2=1.25)
    pgsql/src/backend/utils/misc:
        guc.c (r1.507 -> r1.508)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/misc/guc.c?r1=1.507&r2=1.508)
        postgresql.conf.sample (r1.261 -> r1.262)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/misc/postgresql.conf.sample?r1=1.261&r2=1.262)
    pgsql/src/include/nodes:
        relation.h (r1.173 -> r1.174)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/relation.h?r1=1.173&r2=1.174)
    pgsql/src/include/optimizer:
        geqo.h (r1.44 -> r1.45)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/geqo.h?r1=1.44&r2=1.45)
        geqo_copy.h (r1.21 -> r1.22)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/geqo_copy.h?r1=1.21&r2=1.22)
        geqo_mutation.h (r1.21 -> r1.22)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/geqo_mutation.h?r1=1.21&r2=1.22)
        geqo_pool.h (r1.25 -> r1.26)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/geqo_pool.h?r1=1.25&r2=1.26)
        geqo_random.h (r1.21 -> r1.22)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/geqo_random.h?r1=1.21&r2=1.22)
        geqo_recombination.h (r1.20 -> r1.21)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/geqo_recombination.h?r1=1.20&r2=1.21)
        geqo_selection.h (r1.21 -> r1.22)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/geqo_selection.h?r1=1.21&r2=1.22)

Added Files:
-----------
    pgsql/src/backend/optimizer/geqo:
        geqo_random.c (r1.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_random.c?rev=1.1&content-type=text/x-cvsweb-markup)

pgsql-committers by date

Next:From: User MkzDate: 2009-07-17 15:47:50
Subject: pgbouncer - pgbouncer: doc/usage.txt improvements Patch by Greg Sabino
Previous:From: Tom LaneDate: 2009-07-16 17:43:52
Subject: pgsql: Add erand48() to the set of functions supported by our src/port/

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group