From: Shigeru Hanada Date: Fri, 25 Feb 2011 02:36:40 +0000 (+0900) Subject: Use get_relation_data_width() to get average data width. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=d41fb4aa1c7454aef71ec0264bb3320a7f6a8ca7;p=users%2Fhanada%2Fpostgres.git Use get_relation_data_width() to get average data width. --- 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; } /* ============================================================================