Cost overestimation of foreign JOIN - Mailing list pgsql-hackers

From Andrey Lepikhov
Subject Cost overestimation of foreign JOIN
Date
Msg-id 2b4a65b6-c28c-276c-f66a-e1d71e3d0a86@postgrespro.ru
Whole thread Raw
Responses Re: Cost overestimation of foreign JOIN  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

While testing of Asynchronous Append feature with TPC-H queries, I found 
that the push-down JOIN technique is rarely used.
For my servers fdw_tuple_cost = 0.2, fdw_startup_cost = 100.
Exploring the code, i found in postgres_fdw, estimate_path_cost_size(), 
lines 2908,2909:
run_cost += nrows * join_cost.per_tuple;
nrows = clamp_row_est(nrows * fpinfo->joinclause_sel);

Above:
nrows = fpinfo_i->rows * fpinfo_o->rows;

Maybe it is needed to swap lines 2908 and 2909 (see attachment)?

In my case of two big partitioned tables and small join result it 
strongly influenced on choice of the JOIN push-down strategy.

-- 
regards,
Andrey Lepikhov
Postgres Professional

Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Autovacuum on partitioned table (autoanalyze)
Next
From: Justin Pryzby
Date:
Subject: allow to \dtS+ pg_toast.*