Thread: pgsql: Eliminate a lot of list-management overhead within

pgsql: Eliminate a lot of list-management overhead within

From
tgl@postgresql.org (Tom Lane)
Date:
Log Message:
-----------
Eliminate a lot of list-management overhead within join_search_one_level
by adding a requirement that build_join_rel add new join RelOptInfos to the
appropriate list immediately at creation.  Per report from Robert Haas,
the list_concat_unique_ptr() calls that this change eliminates were taking
the lion's share of the runtime in larger join problems.  This doesn't do
anything to fix the fundamental combinatorial explosion in large join
problems, but it should push out the threshold of pain a bit further.

Note: because this changes the order in which joinrel lists are built,
it might result in changes in selected plans in cases where different
alternatives have exactly the same costs.  There is one example in the
regression tests.

Modified Files:
--------------
    pgsql/src/backend/nodes:
        outfuncs.c (r1.372 -> r1.373)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.372&r2=1.373)
    pgsql/src/backend/optimizer/geqo:
        geqo_eval.c (r1.90 -> r1.91)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/geqo/geqo_eval.c?r1=1.90&r2=1.91)
    pgsql/src/backend/optimizer/path:
        allpaths.c (r1.190 -> r1.191)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/allpaths.c?r1=1.190&r2=1.191)
        joinrels.c (r1.102 -> r1.103)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/joinrels.c?r1=1.102&r2=1.103)
    pgsql/src/backend/optimizer/plan:
        planmain.c (r1.115 -> r1.116)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planmain.c?r1=1.115&r2=1.116)
    pgsql/src/backend/optimizer/util:
        relnode.c (r1.95 -> r1.96)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/relnode.c?r1=1.95&r2=1.96)
    pgsql/src/include/nodes:
        relation.h (r1.179 -> r1.180)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/relation.h?r1=1.179&r2=1.180)
    pgsql/src/include/optimizer:
        paths.h (r1.108 -> r1.109)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/paths.h?r1=1.108&r2=1.109)
    pgsql/src/test/regress/expected:
        join.out (r1.41 -> r1.42)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/join.out?r1=1.41&r2=1.42)