Fix tuple_fraction calculation in generate_orderedappend_paths() master github/master
authorAlexander Korotkov <[email protected]>
Sun, 18 May 2025 20:49:50 +0000 (23:49 +0300)
committerAlexander Korotkov <[email protected]>
Sun, 18 May 2025 20:49:50 +0000 (23:49 +0300)
commit3d3a81fc24b07f04df81d898f6b4e85c553ef604
tree80df4269d9ed7c2655ca8fa2953ac2147500ba49
parent12eee85e511ff8854ac61e8caad8cec218b20513
Fix tuple_fraction calculation in generate_orderedappend_paths()

6b94e7a6da adjusted generate_orderedappend_paths() to consider fractional
paths.  However, it didn't manage to interpret the tuple_fraction value
correctly.  According to the header comment of grouping_planner(), the
tuple_fraction >= 1 specifies the absolute number of expected tuples.  That
number must be divided by the expected total number of tuples to get the
actual fraction.

Even though this is a bug fix, we don't backpatch it.  The risks of the side
effects of plan changes on stable branches are too high.

Reported-by: Andrei Lepikhov <[email protected]>
Discussion: https://postgr.es/m/3ca271fa-ca5c-458c-8934-eb148622b270%40gmail.com
Author: Andrei Lepikhov <[email protected]>
Reviewed-by: Junwang Zhao <[email protected]>
Reviewed-by: Alvaro Herrera <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
src/backend/optimizer/path/allpaths.c
src/test/regress/expected/partition_join.out
src/test/regress/sql/partition_join.sql