On Thu, Sep 29, 2022 at 4:27 PM Bruce Momjian <br...@momjian.us> wrote: > I think the point the original poster as making, and I have made in the > past, is that even of two optimizer costs are the same, one might be > more penalized by misestimation than the other, and we don't have a good > way of figuring that into our plan choices.
Right. But that seems fraught with difficulty. I suspect that the costs that the planner attributes to each plan often aren't very reliable in any absolute sense, even when everything is working very well by every available metric. Even a very noisy cost model with somewhat inaccurate selectivity estimates will often pick the cheapest plan, or close enough. Having a cost-based optimizer that determines the cheapest plan quite reliably is one thing. Taking the same underlying information and adding the dimension of risk to it and expecting a useful result is quite another -- that seems far harder. -- Peter Geoghegan