Re: add_path optimization - Mailing list pgsql-hackers

From Robert Haas
Subject Re: add_path optimization
Date
Msg-id 603c8f070902271938h4e61bec7n2aac3b0c39b32aa8@mail.gmail.com
Whole thread Raw
In response to Re: add_path optimization  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: add_path optimization
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: add_path optimization
Next
From: Andrew Dunstan
Date:
Subject: Re: xpath processing brain dead