Re: Glacially slow nested SELECT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Demitri Muna <thatsanicehatyouhave(at)mac(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Glacially slow nested SELECT
Date: 2007-01-15 18:44:42
Message-ID: 18706.1168886682@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Demitri Muna <thatsanicehatyouhave(at)mac(dot)com> writes:
> On 15 Jan 2007, at 16:21, Tom Lane wrote:
>> It looks like spview is a view with an embedded ORDER BY? IIRC that
>> prevents any meaningful optimization of joins to it --- and
>> WHERE-IN-sub-SELECT is a kind of join.

> Thanks for the pointer Tom; removing the ORDER BY from the view did
> the trick. Is there a reason that the sorting can't be done after the
> selection?

Well, it'd require major revisions to the planner, and it'd break
various queries that depend on the planner honoring sub-select ORDER BY
(people use that to guarantee the order in which values are fed to
custom aggregates, for instance).

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albert 2007-01-15 18:57:17 Reserve a value in a serial type field
Previous Message Tom Lane 2007-01-15 18:41:04 Re: [HACKERS] Checkpoint request failed on version 8.2.1.