postgresql/src/include
Tom Lane 624e440a47 Improve the heuristic for ordering child paths of a parallel append.
Commit ab7271677 introduced code that attempts to order the child
scans of a Parallel Append node in a way that will minimize execution
time, based on total cost and startup cost.  However, it failed to
think hard about what to do when estimated costs are exactly equal;
a case that's particularly likely to occur when comparing on startup
cost.  In such a case the ordering of the child paths would be left
to the whims of qsort, an algorithm that isn't even stable.

We can improve matters by applying the rule used elsewhere in the
planner: if total costs are equal, sort on startup cost, and
vice versa.  When both cost estimates are exactly equal, rather
than letting qsort do something unpredictable, sort based on the
child paths' relids, which should typically result in sorting in
inheritance order.  (The latter provision requires inventing a
qsort-style comparator for bitmapsets, but maybe we'll have use
for that for other reasons in future.)

This results in a few plan changes in the select_parallel test,
but those all look more reasonable than before, when the actual
underlying cost numbers are taken into account.

Discussion: https://postgr.es/m/4944.1515446989@sss.pgh.pa.us
2018-01-09 13:07:52 -05:00
..
access Update copyright for 2018 2018-01-02 23:30:12 -05:00
bootstrap Update copyright for 2018 2018-01-02 23:30:12 -05:00
catalog Minor preparatory refactoring for UPDATE row movement. 2018-01-04 16:25:49 -05:00
commands Update copyright for 2018 2018-01-02 23:30:12 -05:00
common Implement channel binding tls-server-end-point for SCRAM 2018-01-04 15:29:50 -05:00
datatype Update copyright for 2018 2018-01-02 23:30:12 -05:00
executor Factor error generation out of ExecPartitionCheck. 2018-01-05 15:22:33 -05:00
fe_utils Update copyright for 2018 2018-01-02 23:30:12 -05:00
foreign Update copyright for 2018 2018-01-02 23:30:12 -05:00
lib Update copyright for 2018 2018-01-02 23:30:12 -05:00
libpq Implement channel binding tls-server-end-point for SCRAM 2018-01-04 15:29:50 -05:00
mb Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Improve the heuristic for ordering child paths of a parallel append. 2018-01-09 13:07:52 -05:00
optimizer Update copyright for 2018 2018-01-02 23:30:12 -05:00
parser Update copyright for 2018 2018-01-02 23:30:12 -05:00
port Update copyright for 2018 2018-01-02 23:30:12 -05:00
portability Update copyright for 2018 2018-01-02 23:30:12 -05:00
postmaster Update copyright for 2018 2018-01-02 23:30:12 -05:00
regex Update copyright for 2018 2018-01-02 23:30:12 -05:00
replication Fix failure to delete spill files of aborted transactions 2018-01-05 12:17:10 -03:00
rewrite Update copyright for 2018 2018-01-02 23:30:12 -05:00
snowball Update copyright for 2018 2018-01-02 23:30:12 -05:00
statistics Update copyright for 2018 2018-01-02 23:30:12 -05:00
storage Allow ConditionVariable[PrepareTo]Sleep to auto-switch between CVs. 2018-01-09 11:39:10 -05:00
tcop Update copyright for 2018 2018-01-02 23:30:12 -05:00
tsearch Update copyright for 2018 2018-01-02 23:30:12 -05:00
utils Update copyright for 2018 2018-01-02 23:30:12 -05:00
.gitignore Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
c.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
fmgr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
funcapi.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
getaddrinfo.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
getopt_long.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
Makefile Add statistics subdirectory to Makefile. 2017-06-08 11:29:50 -04:00
miscadmin.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_config.h.in Another attempt at fixing build with various OpenSSL versions 2018-01-04 19:09:27 -05:00
pg_config.h.win32 Provide overflow safe integer math inline functions. 2017-12-12 16:55:37 -08:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_getopt.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_trace.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgstat.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgtar.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgtime.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
port.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
postgres.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
rusagestub.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
windowapi.h Update copyright for 2018 2018-01-02 23:30:12 -05:00