Patch to Remove INNER JOINs

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Patch to Remove INNER JOINs
Date: 2014-09-17 08:41:27
Message-ID: CAApHDvp4SsyQq5r+j5iUA1rF1SuWGD5QrhoVLqOqOxVXe=Njxw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Over here ->
http://www.postgresql.org/message-id/CAApHDvqd99i2eeSY6PhUeo8CmKkuDHenzSA-eDAmswSzhU2_Dw@mail.gmail.com
I posted a patch to add support for removing SEMI and ANTI joins, where the
join could be proved useless by the existence of a foreign key.

The patch was part of my incremental work with the end goal of allowing
INNER JOIN removal using similar logic. Though it seems that nobody was
interested the extra code for such a small use case as semi/anti join
removal.

Over here ->
http://www.postgresql.org/message-id/2261.1409163818@sss.pgh.pa.us Tom said
he'd rather see the INNER JOIN removal stuff working before getting all the
required infrastructure into the code base... (or at least that's how I
understood it) I then went off and started working on the INNER JOIN
removal stuff and posted it here ->
http://www.postgresql.org/message-id/CAApHDvpDXXvKE+=ug1kA--nKfa=bjrjvK8Gp9G8UYwv6nHckVg@mail.gmail.com
, so there's now little point in going on with discussions on the thread
that was meant for semi/anti join removals. Hence why I'm starting a new
one to talk about the INNER JOIN removal patch. I'm hoping this subject
will generate enough interest for a review at some point.

I've attached a patch that I've done a bit more work on based on a few
comments gathered from the semi/anti join thread.

For anyone that's not clicked the links above.. Here's a demo of what the
patch does.

test=# create table c (id int primary key);
CREATE TABLE
test=# create table b (id int primary key, c_id int not null references
c(id));
CREATE TABLE
test=# create table a (id int primary key, b_id int not null references
b(id));
CREATE TABLE
test=#
test=# explain select a.* from a inner join b on a.b_id = b.id inner join c
on b.c_id = c.id;
QUERY PLAN
-----------------------------------------------------
Seq Scan on a (cost=0.00..31.40 rows=2140 width=8)
Planning time: 1.061 ms

Regards

David Rowley

Attachment Content-Type Size
inner_join_removals_2014-09-17_d17e608.patch application/octet-stream 57.3 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2014-09-17 09:04:16 Re: KNN-GiST with recheck
Previous Message Emre Hasegeli 2014-09-17 08:30:00 Re: KNN-GiST with recheck