Re: [GENERAL] Partitioning

Поиск
Список
Период
Сортировка
От George Neuner
Тема Re: [GENERAL] Partitioning
Дата
Msg-id 96thncd3iicb6g2nhd30fiq0d213digbab@4ax.com
обсуждение исходный текст
Ответ на [GENERAL] Partitioning  (Krithika Venkatesh <krithikavenkatesh31@gmail.com>)
Список pgsql-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

В списке pgsql-general по дате отправления:

Предыдущее
От: Dmitry Lazurkin
Дата:
Сообщение: Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: [GENERAL] Indexes being ignored after upgrade to 9.5