Cost estimation in foreign data wrappers

From: Hadi Moshayedi <hadi(at)moshayedi(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Cost estimation in foreign data wrappers
Date: 2014-02-21 14:11:53
Message-ID: CAK=1=WoyxQnXzGEbuZr2cRaXgS5fbR1o=cwYV=QRcfg079UKRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

There is a callback function in fdw's which should also set estimates for
startup and total costs for each path. Assume a fdw adds only one path
(e.g. in file_fdw). I am trying to understand what can go wrong if we do a
bad job in estimating these costs.

Since we have only one scan path here, it doesn't make a difference in
choosing the best scan path.

By looking at the code and doing some experiments, I think this can
be significant in (1) underestimating a nested loop's cost, (2) not
materializing inner table in nested loop.

* Are there any other cases that this can be significant?
* Assume we are not sure about the exact cost, but we know that it is in
[lower_bound, upper_bound] range, where upper_bound can be 10x lower_bound
Then, what value is better to choose? lower bound? upper bound? or average?

Thanks,
-- Hadi

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-02-21 14:15:11 Re: Storing the password in .pgpass file in an encrypted format
Previous Message Andres Freund 2014-02-21 13:56:39 Re: Changeset Extraction v7.6.1