Re: CTE Materialization

Поиск
Список
Период
Сортировка
От Paul van der Linden
Тема Re: CTE Materialization
Дата
Msg-id CAEC-EqC0OUG1Tng61fgq-ckLMCANWoqLoLJFVL1yo9ARX46geQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: CTE Materialization  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: CTE Materialization  (Richard Michael <rmichael@edgeofthenet.org>)
Список pgsql-general

On Wed, Dec 8, 2021 at 3:14 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Tue, Dec 7, 2021 at 6:40 PM Дмитрий Иванов <firstdismay@gmail.com> wrote:
I beg your pardon.
The problem is more or less clear to me, but the solution is not. What does the "hack is to add an "offset 0" to the query" suggest? Thank you.


A subquery with a LIMIT clause cannot have where clause expressions in upper parts of the query tree pushed down it without changing the overall query result - something the planner is not allowed to do.  For the hack, since adding an actual LIMIT clause doesn't make sense you omit it, but still add the related OFFSET clause so the planner still treats the subquery as a LIMIT subquery.  And since you don't want to skip any rows you specify 0 for the offset.

David J.

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

Предыдущее
От: Vincent Veyron
Дата:
Сообщение: Re: How to allow null as an option when using regexp_matches?
Следующее
От: Roxanne Reid-Bennett
Дата:
Сообщение: Re: How to allow null as an option when using regexp_matches?