Thanks for taking a look at it.
> I first tried just the compare_fuzzy_path_costs() change and really
> couldn't measure any reliable difference. oprofile output for CVS HEAD
> looks like
Well, there's obviously something different between your case and
mine, because in my query add_path was the #1 CPU hog and it wasn't
close. I suspect my query had more joins - I'll take a look at yours.
> It gets worse though: add_similar_paths is flat *wrong*. It compares
> each successive path to only the current cheapest-total candidate,
> and thus is quite likely to seize on the wrong cheapest-startup path.
> I tried fixing its loop logic like so:
Nuts. That's probably a fatal defect.
> Now, maybe if we could force the compiler to inline
> compare_fuzzy_path_costs we could buy some of that back. Another
> possibility is to contort add_similar_path some more so that it avoids
> double comparisons so long as cheapest_total and cheapest_startup are
> the same path; I have a feeling that's not going to win much though.
Agreed.
> So it's kind of looking like a dead end from here. But in any case the
> patch isn't acceptable as-is with that fundamental logic error in
> add_similar_paths, so I'm bouncing it back for rework.
...Robert