Re: add_path optimization

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: add_path optimization
Date: 2009-02-04 18:38:47
Message-ID: 4925.1233772727@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Now, since I'm running without any stats, it might be that it's
> estimating similar costs for the one-key and two-key merges; but I don't
> see why that would happen for you. Off to do some debugging.

... well, actually, it's because I blew off applying any cost correction
for this case in cost_mergejoin:

* For SEMI and ANTI joins, only one inner tuple need be rescanned for
* each group of same-keyed outer tuples (assuming that all joinquals
* are merge quals). This makes the effect small enough to ignore,
* so we just set rescannedtuples = 0.

Obviously that's not going to be good enough for production --- the
parenthetical assumption here is just wrong in the case at hand.

That doesn't seem to be the only issue in your example, but it's
definitely one of 'em.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2009-02-04 18:39:07 Re: [PATCHES] GIN improvements
Previous Message Bruce Momjian 2009-02-04 18:32:47 Re: [HACKERS] BUG #4516: FOUND variable does not work after RETURN QUERY