Re: pgsql: Fix O(N^2) performance issue in pg_publication_tables view.

Поиск
Список
Период
Сортировка
От Fabrízio de Royes Mello
Тема Re: pgsql: Fix O(N^2) performance issue in pg_publication_tables view.
Дата
Msg-id CAFcNs+r0sKuodMySqypN_Lt=dsF8aOiVUnTWQ2bY1vLU6RZExQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pgsql: Fix O(N^2) performance issue in pg_publication_tables view.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pgsql: Fix O(N^2) performance issue in pg_publication_tables view.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers

On Wed, May 22, 2019 at 3:01 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Fabrízio de Royes Mello <fabriziomello@gmail.com> writes:
> > Just one doubt, why use LATERAL with pg_get_publication_tables SRF instead
> > of JOIN direct to pg_publication_rel?
>
> Yes, LATERAL is just a noise word in this context, but I think
> it's good for documentation purposes.
>
> If you're asking why I used a comma instead of JOIN ... ON TRUE,
> it's because I don't find the latter to be particularly readable
> or good style.  YMMV.
>
> (I agree it's a little weird that the original coding had a mix
> of comma and JOIN syntax, but I did not feel a need to revisit
> that.)
>

I'm not wonder about mix of comma and JOIN syntax, I meant why don't do it?

-    FROM pg_publication P,
-         LATERAL pg_get_publication_tables(P.pubname) GPT,
-         pg_class C JOIN pg_namespace N ON (N.oid = C.relnamespace)
-    WHERE C.oid = GPT.relid;
+    FROM pg_publication P
+         JOIN pg_publication_rel PR ON (PR.prpubid = P.oid)
+         JOIN pg_class C ON (C.oid = PR.prrelid)
+         JOIN pg_namespace N ON (N.oid = C.relnamespace);

There are some case I missed to force us to use pg_get_publication_tables SRF instead of use pg_publication_rel ??

Regards,

--
   Fabrízio de Royes Mello         Timbira - http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Fix O(N^2) performance issue in pg_publication_tables view.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Fix O(N^2) performance issue in pg_publication_tables view.