Re: Partitioning and postgres_fdw optimisations for multi-tenancy

Поиск
Список
Период
Сортировка
От Etsuro Fujita
Тема Re: Partitioning and postgres_fdw optimisations for multi-tenancy
Дата
Msg-id CAPmGK163KgoTn5GcqYArh7W6-3Tk+KznrZOu0vdV0L-5yEd4vg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Partitioning and postgres_fdw optimisations for multi-tenancy  (Alexey Kondratov <a.kondratov@postgrespro.ru>)
Ответы Re: Partitioning and postgres_fdw optimisations for multi-tenancy  (Etsuro Fujita <etsuro.fujita@gmail.com>)
Список pgsql-hackers
On Wed, Jul 15, 2020 at 12:12 AM Alexey Kondratov
<a.kondratov@postgrespro.ru> wrote:
> On 2020-07-14 15:27, Ashutosh Bapat wrote:
> > On Tue, Jul 14, 2020 at 12:48 AM Alexey Kondratov
> > <a.kondratov@postgrespro.ru> wrote:
> >> Some real-life test queries show, that all single-node queries aren't
> >> pushed-down to the required node. For example:
> >>
> >> SELECT
> >>      *
> >> FROM
> >>      documents
> >>      INNER JOIN users ON documents.user_id = users.id
> >> WHERE
> >>      documents.company_id = 5
> >>      AND users.company_id = 5;
> >
> > There are a couple of things happening here
> > 1. the clauses on company_id in WHERE clause are causing partition
> > pruning. Partition-wise join is disabled with partition pruning before
> > PG13.

More precisely, PWJ cannot be applied when there are no matched
partitions on the nullable side due to partition pruning before PG13.
But the join is an inner join, so I think PWJ can still be applied for
the join.

> > In PG13 we have added advanced partition matching algorithm
> > which will allow partition-wise join with partition pruning.

> BTW, can you, please, share a link to commit / thread about allowing
> partition-wise join and partition pruning to work together in PG13?

I think the link would be this:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=c8434d64ce03c32e0029417a82ae937f2055268f

Unfortunately, advanced PWJ added by the commit only allows PWJ and
partition pruning to work together for list/range partitioned tables,
not for hash partitioned tables.  However, I think the commit would
have nothing to do with the issue here, because 1) the tables involved
in the join have the same partition bounds, and 2) the commit doesn't
change the behavior of such a join.

Best regards,
Etsuro Fujita



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

Предыдущее
От: Masahiro Ikeda
Дата:
Сообщение: Re: Transactions involving multiple postgres foreign servers, take 2
Следующее
От: Alexander Korotkov
Дата:
Сообщение: Re: Mark btree_gist functions as PARALLEL SAFE