pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Linos <info@linos.es>
To: pgsql-performance@postgresql.org
Subject: unneeded joins on view
Date: Wed, 16 Apr 2014 17:13:24 +0200
Message-ID: <534E9E14.5000304@linos.es> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Hello all,

I am trying to simplify some of the queries I use with my database creating a big view of all the possible attributes my items can have, the view is rather large:

http://pastebin.com/ScnJ8Hd3


I thought that Postgresql would optimize out joins on columns I don't ask for when I use the view but it doesn't, this query:

SELECT referencia
FROM articulo_view
WHERE referencia = '09411000';


Have this query plan:

http://explain.depesz.com/s/4lW0


Maybe I am surpassing some limit? I have tried changing from_collapse_limit and join_collapse_limit but still the planner join the unneeded tables.

Is possible to tell Postgresql do the right thing? If so, how? Thanks!

Regards,
Miguel Angel.


-- 
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)  latest in thread

Message-ID: <534E9E14.5000304@linos.es>
Permalink:  ../534E9E14.5000304@linos.es/
Also on:    postgresql.org/message-id/534E9E14.5000304@linos.es

 · 

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: info@linos.es
  Subject: Re: unneeded joins on view
  In-Reply-To: <534E9E14.5000304@linos.es>

* 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