Re: add_path optimization

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: add_path optimization
Date: 2009-02-28 03:38:48
Message-ID: 603c8f070902271938h4e61bec7n2aac3b0c39b32aa8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-02-28 03:55:17 Re: xpath processing brain dead
Previous Message Tom Lane 2009-02-28 02:35:34 Re: add_path optimization