Re: Cost overestimation of foreign JOIN - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Cost overestimation of foreign JOIN
Date
Msg-id 1272904.1606757911@sss.pgh.pa.us
Whole thread Raw
In response to Cost overestimation of foreign JOIN  (Andrey Lepikhov <a.lepikhov@postgrespro.ru>)
Responses Re: Cost overestimation of foreign JOIN  (Andrey Lepikhov <a.lepikhov@postgrespro.ru>)
List pgsql-hackers
Andrey Lepikhov <a.lepikhov@postgrespro.ru> writes:
> Maybe it is needed to swap lines 2908 and 2909 (see attachment)?

No; as explained in the comment immediately above here, we're assuming
that the join conditions will be applied on the cross product of the
input relations.

Now admittedly, that's a worst-case assumption, since it amounts to
expecting that the remote server will do the join in the dumbest
possible nested-loop way.  If the remote can use a merge or hash
join, for example, the cost is likely to be a lot less.  But it is
not the job of this code path to outguess the remote planner.  It's
certainly not appropriate to invent an unprincipled cost estimate
as a substitute for trying to guess that.

If you're unhappy with the planning results you get for this,
why don't you have use_remote_estimate turned on?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Alexey Kondratov
Date:
Subject: Re: Notes on physical replica failover with logical publisher or subscriber
Next
From: Alvaro Herrera
Date:
Subject: Re: Autovacuum on partitioned table (autoanalyze)