Show estimated number of groups for Incremental Sort in EXPLAIN Incremental Sort's costs heavily depend on the estimated number of input groups with equal presorted key values. Overestimations can cause the planner to choose Incremental Sort over Sort when Sort would have been a better choice.
Here, we add the planner's estimate to EXPLAIN to allow easier understanding of why Incremental Sort has been chosen. Author: Ilia Evdokimov <[email protected]> Reviewed-by: Enrique Sánchez <[email protected]> Reviewed-by: David Rowley <[email protected]> Reviewed-by: solai v <[email protected]> Discussion: https://postgr.es/m/10682fef-3748-43f5-a932-7adcdd9bd2b8%40tantorlabs.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/d29d469becec1f2ac082d82863ae1c29fca9dd97 Modified Files -------------- doc/src/sgml/perform.sgml | 1 + src/backend/commands/explain.c | 5 +++++ src/backend/optimizer/path/costsize.c | 16 +++++++++++++--- src/backend/optimizer/plan/createplan.c | 4 +++- src/backend/optimizer/util/pathnode.c | 6 ++++-- src/include/nodes/pathnodes.h | 1 + src/include/nodes/plannodes.h | 2 ++ src/include/optimizer/cost.h | 3 ++- 8 files changed, 31 insertions(+), 7 deletions(-)
