| From: | "Matheus Alcantara" <matheusssilv97(at)gmail(dot)com> |
|---|---|
| To: | "Alexander Pyhalov" <a(dot)pyhalov(at)postgrespro(dot)ru>, "Matheus Alcantara" <matheusssilv97(at)gmail(dot)com> |
| Cc: | "Alena Rybakina" <a(dot)rybakina(at)postgrespro(dot)ru>, "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Asynchronous MergeAppend |
| Date: | 2025-12-19 13:45:29 |
| Message-ID: | DF28LV8UTUOO.71JUZDH1N8F9@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu Dec 18, 2025 at 6:56 AM -03, Alexander Pyhalov wrote:
>> + noccurred = WaitEventSetWait(node->ms_eventset, -1 /* no timeout */ ,
>> occurred_event,
>> + nevents, WAIT_EVENT_APPEND_READY);
>>
>> Should we use the same WAIT_EVENT_APPEND_READY or create a new wait
>> event for merge append?
>
> I'm not sure that new wait event is needed - for observability I think
> it's not critical
> to distinguish Append and MergeAppend when they waited for foreign
> scans. But also it's perhaps
> doesn't do any harm to record specific wait event.
>
Ok, I think that we can keep this way for now and let's see if a new
wait event is really needed.
>> I've created Appender and AppenderState types that are used by
>> Append/MergeAppend and AppendState/MergeAppendState respectively (I
>> should have think in a better name for these base type, ideas are
>> welcome). The execAppend.c was created to have the functions that can
>> be
>> reused by Append and MergeAppend execution. I've tried to remove
>> duplicated code blocks that was almost the same and that didn't require
>> much refactoring.
>
> Overall I like new Appender node. Splitting code in this way really
> helps to avoid code duplication.
> However, some similar code is still needed, because logic of getting new
> tuples is different.
>
Indeed.
> Some minor issues I've noticed.
> 1) ExecReScanAppender() sets node->needrequest to NULL.
> ExecReScanAppend() calls bms_free(node->as.needrequest) immediately
> after this. The same is true for ExecReScanMergeAppend(). We should move
> it to ExecReScanAppender().
>
Fixed
> 2) In src/backend/executor/execAppend.c:
> planstates are named as mergeplans in ExecEndAppender(), perhaps,
> appendplans or subplans are better names.
>
Fixed
> ExecInitAppender() could use palloc_array() to allocate appendplanstates
> - as ExecInitMergeAppend().
>
Fixed
--
Matheus Alcantara
EDB: http://www.enterprisedb.com
| Attachment | Content-Type | Size |
|---|---|---|
| v10-0001-mark_async_capable-subpath-should-match-subplan.patch | text/plain | 2.4 KB |
| v10-0002-MergeAppend-should-support-Async-Foreign-Scan-su.patch | text/plain | 50.3 KB |
| v10-0003-Create-execAppend.c-to-avoid-duplicated-code-on-.patch | text/plain | 85.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nazir Bilal Yavuz | 2025-12-19 13:52:11 | ditaa --svg option is missing when building doc/src/sgml/images |
| Previous Message | Kirill Reshke | 2025-12-19 12:30:36 | Re: Allow GUC settings in CREATE SUBSCRIPTION CONNECTION to take effect |