Re: disfavoring unparameterized nested loops - Mailing list pgsql-hackers

From Benjamin Coutu
Subject Re: disfavoring unparameterized nested loops
Date
Msg-id 96dbbf5d33fa97dc4c1f@zeyos.com
Whole thread Raw
In response to Re: disfavoring unparameterized nested loops  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> Agreed, but dealing with uncertainty in those numbers is an enormous
> task if you want to do it right.  "Doing it right", IMV, would start
> out by extending all the selectivity estimation functions to include
> error bars; then we could have error bars on rowcount estimates and
> then costs; then we could start adding policies about avoiding plans
> with too large a possible upper-bound cost.  Trying to add such
> policy with no data to go on is not going to work well.

Error bars would be fantastic, no question. But that would make things very complex.
A lot of judgment calls would be necessary for the policy behind upper-bound pruning, picking up on Peter's comment
about"conviction multiplier of conviction multiplier" ;) 
Also, the math in deriving those bounds based on the stats and how they propagate up the join tree doesn't seem trivial
either.

> I think Peter's point is that a quick-n-dirty patch is likely to make
> as many cases worse as it makes better.  That's certainly my opinion
> about the topic.

As in my reply to Peter, I think the join level/depth metric is a simple but principled way of dealing with it, given
thereferenced research. 
In the first step, we'd use this merely to be more risk-averse towards nested loop joins as we climb up the join tree -
weare not fiddling with the cost model itself, nor the join ordering, just when it comes to considering that particular
joinalgorithm. Later this could be expanded to be more broadly scoped. 

Please not give up on a simple way to reap most of the fruits just yet.



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Refactor UnpinBuffer()
Next
From: "Drouvot, Bertrand"
Date:
Subject: log_heap_visible(): remove unused parameter and update comment