Re: Query palns and tug-of-war with enable_sort

From: Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Query palns and tug-of-war with enable_sort
Date: 2009-02-18 23:30:32
Message-ID: 236173.51954.qm@web23607.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> No, those aren't the same plans. In particular
> what's bothering me is
> the lack of any sort in the first plan you showed (the one
> with
> HashAggregate at the top). That shouldn't be possible
> because of the
> ORDER BY --- a hash aggregate will deliver unsorted output
> so there
> should be a sort step above it.

Ah, retracing my steps forget that; there's no sort because it's not the same query at all.

explain Select
mult_ord.mult_ref
From
credit Inner Join
mult_ord On mult_ord.transno = credit.transno
Where
(credit.show = 450000 Or
credit.show = 450001) And
credit."date" >= '2009-02-16' And
credit."date" <= '2009-02-16' And
credit.cancelled = ' ' group by mult_ref;

Lets just say it's been a long day.

Going back to my original point though, is there any way to get the planner to choose a better plan for the original distinct query? Or is it just a simple no because I set enable_sort to off?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-02-18 23:44:01 Re: Postgres service fails to start on Windows 2003
Previous Message Mike Christensen 2009-02-18 22:31:24 Re: Postgres service fails to start on Windows 2003