Re: Query plan excluding index on view

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Matt Klinker" <mklinker(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query plan excluding index on view
Date: 2008-04-05 04:20:43
Message-ID: 28880.1207369243@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message James Mansion 2008-04-06 20:21:41 Re: Performance Implications of Using Exceptions
Previous Message Gregory Stark 2008-04-05 01:26:36 Re: Partitioned tables - planner wont use indexes