Re: speedup COPY TO for partitioned table.
Chao Li <li.evan.chao@gmail.com>
From: Chao Li <li.evan.chao@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, torikoshia <torikoshia@oss.nttdata.com>, Álvaro Herrera <alvherre@kurilemu.de>, Kirill Reshke <reshkekirill@gmail.com>, vignesh C <vignesh21@gmail.com>, David Rowley <dgrowleyml@gmail.com>, Melih Mutlu <m.melihmutlu@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-10-10T03:29:01Z
Lists: pgsql-hackers
> On Oct 10, 2025, at 10:54, jian he <jian.universality@gmail.com> wrote: > >> 5 >> ``` >> +static void >> +CopyRelTo(CopyToState cstate, Relation rel, Relation root_rel, >> + uint64 *processed) >> ``` >> >> Instead of using a pointer to pass out processed count, I think it’s better to return the process count. I understand the current implementation allows continuous increment while calling this function in a loop. However, it’s a bit error-prone, a caller must make sure “processed” is well initialized. With returning a unit64, the caller’s code is still simple: >> >> ``` >> processed += CopyRelTo(cstate, …); >> ``` >> >> pgstat_progress_update_param was within CopyRelTo. >> so we have to pass (uint64 *processed) to CopyRelTo. >> Am I missing something? >> >> >> Make sense. I didn’t notice postage_progress_update_param. So, “processed” is both input and output. In that case, I think the comment for parameter “processed” should be enhanced, for example: >> > if your function is: > > static processed CopyRelationTo(CopyToState cstate, Relation rel, > Relation root_rel, uint64 *processed); > > where function return value is also passed as function argument, > I think it will lead to more confusion. I am not suggesting add a return value to the function. My comment was just to enhance the parameter comment of “processed”. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Support COPY TO for partitioned tables.
- 4bea91f21f61 19 (unreleased) landed
-
Re-implement the ereport() macro using __VA_ARGS__.
- e3a87b4991cc 13.0 cited