Re: Poor Performance running Django unit tests after upgrading from 10.6

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Poor Performance running Django unit tests after upgrading from 10.6
Дата
Msg-id e7db6891-7ce9-aab1-abca-373e94692fd4@dunslane.net
обсуждение исходный текст
Ответ на Poor Performance running Django unit tests after upgrading from 10.6  (Roger Hunwicks <roger@tonic-solutions.com>)
Список pgsql-performance
On 10/15/20 1:21 AM, Roger Hunwicks wrote:
>
> I think we have narrowed down the problem to a single, very complex,
> materialized view using CTEs; the unit tests create the test data and
> then refresh the materialized view before executing the actual test
> code.
>


Have you checked to see if the CTE query is affected by the change to
how CTEs are run in release 12?


The release notes say:

    Allow common table expressions (CTEs) to be inlined into the outer
    query (Andreas Karlsson, Andrew Gierth, David Fetter, Tom Lane)

    Specifically, CTEs are automatically inlined if they have no
    side-effects, are not recursive, and are referenced only once in the
    query. Inlining can be prevented by specifying MATERIALIZED, or
    forced for multiply-referenced CTEs by specifying NOT MATERIALIZED.
    Previously, CTEs were never inlined and were always evaluated before
    the rest of the query.

So if you haven't already, start by putting MATERIALIZED before each CTE
clause:

    with foo as MATERIALIZED (select ...),

    bar as MATERIALIZED  (select ...),

    ...

and see if that changes anything.



cheers


andrew



--
Andrew Dunstan
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company




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

Предыдущее
От: Roger Hunwicks
Дата:
Сообщение: Poor Performance running Django unit tests after upgrading from 10.6
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Poor Performance running Django unit tests after upgrading from 10.6