pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shaun Thomas <sthomas@optionshouse.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Slow query when used in a view
Date: Tue, 12 Mar 2013 08:49:04 -0500
Message-ID: <513F3250.2050208@optionshouse.com> (raw)
In-Reply-To: <1454.1363046219@sss.pgh.pa.us>
References: <513E5AB9.4010809@optionshouse.com>
	<1454.1363046219@sss.pgh.pa.us>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 03/11/2013 06:56 PM, Tom Lane wrote:

> And that means that you get the inefficient plan wherein the
> foo-to-tiny_foo join is computed in its entirety.

:(

That's unfortunate, though I guess it makes sense. I moved the join in 
the view into the SELECT clause as an EXISTS, and that seems to work 
without major adverse effects. Apparently the tiny table really will be 
tiny in actual use, so impact should be minimal.

I just really don't like using subselects that way. :)

Thanks, Tom!

-- 
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604
312-676-8870
sthomas@optionshouse.com

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (3+ messages)

Message-ID: <513F3250.2050208@optionshouse.com>
Permalink:  ../513F3250.2050208@optionshouse.com/
Also on:    postgresql.org/message-id/513F3250.2050208@optionshouse.com

 · 

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: sthomas@optionshouse.com, tgl@sss.pgh.pa.us
  Subject: Re: Slow query when used in a view
  In-Reply-To: <513F3250.2050208@optionshouse.com>

* 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