Re: Bug in row_number() optimization

Поиск
Список
Период
Сортировка
От Sergey Shinderuk
Тема Re: Bug in row_number() optimization
Дата
Msg-id e126be3a-09ed-7495-778c-1f429f67cb93@postgrespro.ru
обсуждение исходный текст
Ответ на Re: Bug in row_number() optimization  (Richard Guo <guofenglinux@gmail.com>)
Ответы Re: Bug in row_number() optimization
Список pgsql-hackers
On 24.11.2022 06:16, Richard Guo wrote:
> Regarding how to fix this problem, firstly I believe we need to evaluate
> window functions in the per-tuple memory context, as the HEAD does.
> When we decide we need to go into pass-through mode, I'm thinking that
> we can just copy out the results of the last evaluation to the per-query
> memory context, while still storing their pointers in ecxt_aggvalues.
> 
> Does this idea work?
Although I'm not familiar with the code, this makes sense to me.

You proposed:

+#ifdef USE_FLOAT8_BYVAL
+       evalWfuncContext = 
winstate->ss.ps.ps_ExprContext->ecxt_per_tuple_memory;
+#else
+       evalWfuncContext = 
winstate->ss.ps.ps_ExprContext->ecxt_per_query_memory;
+#endif

Shouldn't we handle any pass-by-reference type the same? I suppose, a 
user-defined window function can return some other type, not int8.

Best regards,

-- 
Sergey Shinderuk        https://postgrespro.com/




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

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Report roles in pg_upgrade pg_ prefix check
Следующее
От: Ilya Gladyshev
Дата:
Сообщение: Re: postgres_fdw binary protocol support