From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
---|---|
To: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
Cc: | John Naylor <johncnaylorls(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Parallel heap vacuum |
Date: | 2025-03-05 00:54:20 |
Message-ID: | CAD21AoD4Oy4VaZUPn97J5T-HLFA_deb8TQ7RCWzx-TH8QZoxsA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Mar 3, 2025 at 3:24 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
>
> Another performance regression I can see in the results is that heap
> vacuum phase (phase III) got slower with the patch. It's weired to me
> since I don't touch the code of heap vacuum phase. I'm still
> investigating the cause.
I have investigated this regression. I've confirmed that In both
scenarios (patched and unpatched), the entire table and its associated
indexes were loaded into the shared buffer before the vacuum. Then,
the 'perf record' analysis, focused specifically on the heap vacuum
phase of the patched code, revealed numerous soft page faults
occurring:
62.37% 13.90% postgres postgres [.] lazy_vacuum_heap_rel
|
|--52.44%--lazy_vacuum_heap_rel
| |
| |--46.33%--lazy_vacuum_heap_page (inlined)
| | |
| | |--32.42%--heap_page_is_all_visible (inlined)
| | | |
| | | |--26.46%--HeapTupleSatisfiesVacuum
| | | |
HeapTupleSatisfiesVacuumHorizon
| | | |
HeapTupleHeaderXminCommitted (inlined)
| | | | |
| | | | --18.52%--page_fault
| | | | do_page_fault
| | | |
__do_page_fault
| | | |
handle_mm_fault
| | | |
__handle_mm_fault
| | | |
handle_pte_fault
| | | | |
| | | |
|--16.53%--filemap_map_pages
| | | | | |
| | | | |
--2.63%--alloc_set_pte
| | | | |
pfn_pte
| | | | |
| | | |
--1.99%--pmd_page_vaddr
| | | |
| | | --1.99%--TransactionIdPrecedes
I did not observe these page faults in the 'perf record' results for
the HEAD version. Furthermore, when I disabled parallel heap vacuum
while keeping parallel index vacuuming enabled, the regression
disappeared. Based on these findings, the likely cause of the
regression appears to be that during parallel heap vacuum operations,
table blocks were loaded into the shared buffer by parallel vacuum
workers. However, in the heap vacuum phase, the leader process needed
to process all blocks, resulting in soft page faults while creating
Page Table Entries (PTEs). Without the patch, the backend process had
already created PTEs during the heap scan, thus preventing these
faults from occurring during the heap vacuum phase.
It appears to be an inherent side effect of utilizing parallel
queries. Given this understanding, it's likely an acceptable trade-off
that we can accommodate.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | Euler Taveira | 2025-03-05 00:54:26 | Re: Separate GUC for replication origins |
Previous Message | Jacob Champion | 2025-03-05 00:53:14 | Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible |