From d41fb4aa1c7454aef71ec0264bb3320a7f6a8ca7 Mon Sep 17 00:00:00 2001 From: Shigeru Hanada Date: Fri, 25 Feb 2011 11:36:40 +0900 Subject: [PATCH] Use get_relation_data_width() to get average data width. --- contrib/postgresql_fdw/postgresql_fdw.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/contrib/postgresql_fdw/postgresql_fdw.c b/contrib/postgresql_fdw/postgresql_fdw.c index 89b5790123..39bd1be49f 100644 --- a/contrib/postgresql_fdw/postgresql_fdw.c +++ b/contrib/postgresql_fdw/postgresql_fdw.c @@ -715,26 +715,21 @@ static void estimate_costs(PlannerInfo *root, RelOptInfo *baserel, Cost *startup_cost, Cost *total_cost) { RangeTblEntry *rte; - int width; double connection_cost = 0.0; double transfer_cost = 0.0; elog(DEBUG3, "%s() called", __FUNCTION__); - /* - * Use cost_seqscan() to get approximate value. - */ + /* get avarage width estimation */ rte = planner_rt_fetch(baserel->relid, root); -// cost_seqscan(&path->path, root, baserel); - - width = get_relation_data_width(rte->relid, NULL); + baserel->width = get_relation_data_width(rte->relid, baserel->attr_widths); /* XXX arbitrary guesses */ connection_cost = 10.0; transfer_cost = 1.0; *startup_cost += connection_cost; *total_cost += connection_cost; - *total_cost += transfer_cost * width * baserel->tuples; + *total_cost += transfer_cost * baserel->width * baserel->tuples; } /* ============================================================================ -- 2.39.5