Skip site navigation (1) Skip section navigation (2)

Re: Any better plan for this query?..

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Dimitri <dimitrik(dot)fr(at)gmail(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Dimitri Fontaine <dfontaine(at)hi-media(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Aidan Van Dyk <aidan(at)highrise(dot)ca>, Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Any better plan for this query?..
Date: 2009-05-19 22:49:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> On Tue, 2009-05-19 at 08:58 -0400, Tom Lane wrote:
>> Nonsense.  The planner might think some other plan is cheaper, but
>> it definitely knows how to do this, and has since at least 8.1.

> Please look at Dimitri's plan. If it can remove the pointless sort, why
> does it not do so?

I haven't followed the whole thread, but the plan in the original post
is for a hash join.  The planner does not trust a hash join to preserve
the order of its left input, because of possible batching.  See the
discussion a couple of months ago where we considered allowing the
planner to disable batching so it *could* assume order preservation, and
decided the risk of hashtable bloat was too great.

			regards, tom lane

In response to


pgsql-performance by date

Next:From: Robert HaasDate: 2009-05-20 03:54:19
Subject: Re: Any better plan for this query?..
Previous:From: Merlin MoncureDate: 2009-05-19 21:48:49
Subject: Re: Any better plan for this query?..

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group