pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alessandro Baretta <a.baretta@barettadeit.com>
To: Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Throwing unnecessary joins away
Date: Thu, 12 Jan 2006 13:35:07 +0100
Message-ID: <43C64CFB.9030504@barettadeit.com> (raw)
In-Reply-To: <34608c0c0601120418n1af567b9n@mail.gmail.com>
References: <34608c0c0601120418n1af567b9n@mail.gmail.com>

Ottó Havasvölgyi wrote:
> Hi all,
>  
> Is PostgreSQL able to throw unnecessary joins?
> For example I have two tables, and I join then with their primary keys, 
> say type of bigint . In this case if I don't reference to one of the 
> tables anywhere except the join condition, then the join can be eliminated.
> Or if I do a "table1 left join table2 (table1.referer=table2.id)"  (N : 
> 1 relationship), and I don't reference table2 anywhere else, then it is 
> unnecessary.

It cannot possibly remove "unnecessary joins", simply because the join 
influences whether a tuple in the referenced table gets selected and how many times.

Alex


-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/;

The FreerP Project
<http://www.freerp.org/;



view thread (10+ messages)  latest in thread

Message-ID: <43C64CFB.9030504@barettadeit.com>
Permalink:  ../43C64CFB.9030504@barettadeit.com/
Also on:    postgresql.org/message-id/43C64CFB.9030504@barettadeit.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: a.baretta@barettadeit.com, havasvolgyi.otto@gmail.com
  Subject: Re: Throwing unnecessary joins away
  In-Reply-To: <43C64CFB.9030504@barettadeit.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