Cost overestimation of foreign JOIN

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Cost overestimation of foreign JOIN
Date: 2020-11-30 16:19:11
Message-ID: 2b4a65b6-c28c-276c-f66a-e1d71e3d0a86@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
estimation.diff text/plain 694 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-11-30 16:54:36 allow to \dtS+ pg_toast.*
Previous Message Alvaro Herrera 2020-11-30 16:07:12 Re: Autovacuum on partitioned table (autoanalyze)