From 9bb342811bf6a93a574a648c5848feedbaaef8f2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 12 Sep 2009 22:12:09 +0000 Subject: Rewrite the planner's handling of materialized plan types so that there is an explicit model of rescan costs being different from first-time costs. The costing of Material nodes in particular now has some visible relationship to the actual runtime behavior, where before it was essentially fantasy. This also fixes up a couple of places where different materialized plan types were treated differently for no very good reason (probably just oversights). A couple of the regression tests are affected, because the planner now chooses to put the other relation on the inside of a nestloop-with-materialize. So far as I can see both changes are sane, and the planner is now more consistently following the expectation that it should prefer to materialize the smaller of two relations. Per a recent discussion with Robert Haas. --- src/include/optimizer/cost.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/include/optimizer') diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 343662f6b8..f862979c08 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.97 2009/06/11 14:49:11 momjian Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.98 2009/09/12 22:12:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -86,7 +86,8 @@ extern void cost_sort(Path *path, PlannerInfo *root, double limit_tuples); extern bool sort_exceeds_work_mem(Sort *sort); extern void cost_material(Path *path, - Cost input_cost, double tuples, int width); + Cost input_startup_cost, Cost input_total_cost, + double tuples, int width); extern void cost_agg(Path *path, PlannerInfo *root, AggStrategy aggstrategy, int numAggs, int numGroupCols, double numGroups, -- cgit v1.2.1