pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Simon Riggs <simon@2ndQuadrant.com>
Cc: List pgsql-patches <pgsql-patches@postgresql.org>
Subject: Re: WIP Join Removal
Date: Mon, 01 Sep 2008 22:23:19 +0300
Message-ID: <48BC4127.30706@enterprisedb.com> (raw)
In-Reply-To: <1220176372.4371.118.camel@ebony.2ndQuadrant>
References: <1220176372.4371.118.camel@ebony.2ndQuadrant>

Simon Riggs wrote:
> Patch works, but there's a bit I haven't finished yet - checking unique
> indexes.

Did plan invalidation make it safe to rely on the presence of a unique 
index for planning decisions?

Couldn't we also do join removal for inner joins, when there's a foreign 
key reference that enforces that there's one and only one matching tuple 
in the removed table:

SELECT child.data FROM child, parent WHERE child.fkey = parent.pkey

?


> + 	/*
> + 	 * We can now remove join by pulling up child plan from the keeprel.
> + 	 * This needs to be done considering costs, since its possible for
> + 	 * a nested inner indexscan plan to be cheaper. So it isn't
> + 	 * always desirable to remove the join.

Can you elaborate that a bit? I can't imagine a case where we wouldn't 
want to remove a join, when we know we can.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (26+ messages)  latest in thread

Message-ID: <48BC4127.30706@enterprisedb.com>
Permalink:  ../48BC4127.30706@enterprisedb.com/
Also on:    postgresql.org/message-id/48BC4127.30706@enterprisedb.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-patches@postgresql.org
  Cc: heikki.linnakangas@enterprisedb.com, simon@2ndQuadrant.com
  Subject: Re: WIP Join Removal
  In-Reply-To: <48BC4127.30706@enterprisedb.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