pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matt Klinker <mklinker@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query plan excluding index on view
Date: Sat, 05 Apr 2008 00:20:43 -0400
Message-ID: <28880.1207369243@sss.pgh.pa.us> (raw)
In-Reply-To: <3bda20f60804040726m15e1b9caqad3883cba960bab0@mail.gmail.com>
References: <3bda20f60804031631j177b42e2u82b5033fd23c2293@mail.gmail.com>
	<28177.1207266621@sss.pgh.pa.us>
	<3bda20f60804031654q7991de08m1254964511632acf@mail.gmail.com>
	<29828.1207271948@sss.pgh.pa.us>
	<3bda20f60804032158u4f6765e3t8b0debad3e7f5ceb@mail.gmail.com>
	<4767.1207288167@sss.pgh.pa.us>
	<3bda20f60804040726m15e1b9caqad3883cba960bab0@mail.gmail.com>

"Matt Klinker" <mklinker@gmail.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



view thread (7+ messages)  latest in thread

Message-ID: <28880.1207369243@sss.pgh.pa.us>
Permalink:  ../28880.1207369243@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28880.1207369243@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mklinker@gmail.com
  Subject: Re: Query plan excluding index on view
  In-Reply-To: <28880.1207369243@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox