From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: speedup COPY TO for partitioned table. |
Date: | 2025-10-10 03:29:01 |
Message-ID: | 012BEF52-159C-4EA1-9313-A42F3EE7D11F@gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Oct 10, 2025, at 10:54, jian he <jian(dot)universality(at)gmail(dot)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/
From | Date | Subject | |
---|---|---|---|
Next Message | shveta malik | 2025-10-10 04:02:30 | Re: POC: enable logical decoding when wal_level = 'replica' without a server restart |
Previous Message | Thomas Munro | 2025-10-10 02:59:12 | Re: GNU/Hurd portability patches |