postgres_fdw: another oddity in costing aggregate pushdown paths

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: postgres_fdw: another oddity in costing aggregate pushdown paths
Date: 2019-02-15 11:19:50
Message-ID: 5C66A056.60007@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As mentioned in the near thread, I think there is another oversight in
the cost estimation for aggregate pushdown paths in postgres_fdw, IIUC.
When costing an aggregate pushdown path using local statistics, we
re-use the estimated costs of implementing the underlying scan/join
relation, cached in the relation's PgFdwRelationInfo (ie,
rel_startup_cost and rel_total_cost). Since these costs wouldn't yet
contain the costs of evaluating the final scan/join target, as tlist
replacement by apply_scanjoin_target_to_paths() is performed afterwards.
So I think we need to adjust these costs so that the tlist eval costs
are included, but ISTM that estimate_path_cost_size() forgot to do so.
Attached is a patch for fixing this issue.

Best regards,
Etsuro Fujita

Attachment Content-Type Size
another-fix-postgres-fdw-grouping-path-cost.patch text/x-patch 3.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2019-02-15 12:01:29 Re: Incorrect visibility test function assigned to snapshot
Previous Message Etsuro Fujita 2019-02-15 11:09:49 Re: Problems with plan estimates in postgres_fdw