From: | Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru> |
---|---|
To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, David Rowley <drowley(at)postgresql(dot)org> |
Subject: | Re: Bug in row_number() optimization |
Date: | 2022-11-24 11:52:30 |
Message-ID: | e126be3a-09ed-7495-778c-1f429f67cb93@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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/
From | Date | Subject | |
---|---|---|---|
Next Message | Ilya Gladyshev | 2022-11-24 12:15:56 | Re: postgres_fdw binary protocol support |
Previous Message | Daniel Gustafsson | 2022-11-24 11:31:09 | Report roles in pg_upgrade pg_ prefix check |