From: George Neuner <gneuner2@comcast.net>
To: pgsql-general@postgresql.org
Subject: Re: Partitioning
Date: Wed, 26 Jul 2017 16:22:03 -0400
Message-ID: <96thncd3iicb6g2nhd30fiq0d213digbab@4ax.com> (raw)
References: <CAP7eca00=EkhYMEDJnwNFxj8aSKJP39Xd8mNeLcV5mOeDow=bA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
On Tue, 25 Jul 2017 18:21:43 +0530, Krithika Venkatesh
<krithikavenkatesh31@gmail.com> wrote:
>I have a table that is partitioned on a numeric column (ID).
>
>Partitioning works when I query the table with no joins.
>
>SELECT * FROM TABLE A a WHERE ID IN (SELECT ID FROM TABLE B b WHERE
>CREATED_TS = CURRENT_TIMESTAMP)
>
>Partitioning doesn't work when I do join.
>
>SELECT A.* FROM TABLE A a INNER JOIN TABLE B b ON a.ID = b.ID.
>
>Is there any other option that would work.
>
>Thanks in Advance..
The subselect is constraining the set of ID value(s) to be matched in
A, which (at least potentially) permits identifying the relevant
partition(s).
The join must include all partitions of A because the set of ID values
to be matched with B are not constrained.
Also, the join query is not equivalent because it does not include the
timestamp constraint on B. I don't think that will make any
difference to the query plan ... AFAICS, it still needs to consider
all partitions of A ... but it may improve performance.
George
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: gneuner2@comcast.net
Subject: Re: Partitioning
In-Reply-To: <96thncd3iicb6g2nhd30fiq0d213digbab@4ax.com>
References: <CAP7eca00=EkhYMEDJnwNFxj8aSKJP39Xd8mNeLcV5mOeDow=bA@mail.gmail.com> <96thncd3iicb6g2nhd30fiq0d213digbab@4ax.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