Re: Strange performance problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Strange performance problem
Дата
Msg-id 32211.1548436922@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Strange performance problem  (Alessandro Manzoni <manzoni.alessandro4@gmail.com>)
Список pgsql-admin
Alessandro Manzoni <manzoni.alessandro4@gmail.com> writes:
> Then I have a complex query that has two complete different 
> performances, in these two cases:

> case a)
> with getfieldone as (select * from tableone where fieldone = 'one')
> select * from getfieldone
> inner join tabletwo on ... [and other joins]

> case b)
> select * from viewone
> inner join tabletwo on ... [and other joins, the same as case a)]

> I expected the same performance, but case a) lasts a few hundreds ms, 
> while case b) lasts more than 12 seconds.

WITH is an optimization fence (at present --- there is discussion
of relaxing that) so it's not exactly surprising that these queries
perform differently.  I am a little surprised though that case a)
is the faster one; usually, preventing the planner from optimizing
the whole query as one problem makes things worse.

Saying more than that would require a lot more detail.

https://wiki.postgresql.org/wiki/Slow_Query_Questions

            regards, tom lane


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

Предыдущее
От: Alessandro Manzoni
Дата:
Сообщение: Strange performance problem
Следующее
От: Luis Agustín Solís García-Barbón
Дата:
Сообщение: How upgrade version pgadmin 4