• Tom Lane's avatar
    Make GEQO's planning deterministic by having it start from a predictable · f5bc7419
    Tom Lane authored
    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
    f5bc7419
geqo_cx.c 2.82 KB