Re: [SOLVED] Query plan excluding index on view

From: "Matt Klinker" <mklinker(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [SOLVED] Query plan excluding index on view
Date: 2008-04-07 15:46:38
Message-ID: 3bda20f60804070846w6e89fa2bg3676ef0d00d14fec@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Removing the constants definitely did take care of the issue on 8.3 (still
same query plan on 8.1). Thanks for your help in getting this resolved, and
sorry again for not including all relevant information on my initial request

On Fri, Apr 4, 2008 at 10:20 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "Matt Klinker" <mklinker(at)gmail(dot)com> writes:
> > --Joined View:
> > CREATE OR REPLACE VIEW directory_listing AS
> > SELECT school.id, school.name, school.description, 119075291 AS
> > listing_type_fid
> > FROM school
> > UNION ALL
> > SELECT company.id, company.name, company.description, 119074833 AS
> > listing_type_fid
> > FROM company;
>
> Ah, there's the problem :-(. Can you get rid of the constants here?
> The planner's currently not smart about UNION ALL subqueries unless
> their SELECT lists contain just simple column references.
>
> (Yes, fixing that is on the todo list, but don't hold your breath...
> it'll be 8.4 material at the earliest.)
>
> regards, tom lane
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Bricklen Anderson 2008-04-07 15:52:50 Re: Partitioned tables - planner wont use indexes
Previous Message Dimi Paun 2008-04-07 15:21:59 Severe performance problems for simple query