From: | Quan Zongliang <quanzongliang(at)yeah(dot)net> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Improving the heapgetpage function improves performance in common scenarios |
Date: | 2023-08-24 10:55:28 |
Message-ID: | a9f40066-3d25-a240-4229-ec2fbe94e7a5@yeah.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi
In the function heapgetpage. If a table is not updated very frequently.
Many actions in tuple loops are superfluous. For all_visible pages,
loctup does not need to be assigned, nor does the "valid" variable.
CheckForSerializableConflictOutNeeded from
HeapCheckForSerializableConflictOut function, it only need to inspect at
the beginning of the cycle only once. Using vtune you can clearly see
the result (attached heapgetpage.jpg).
So by splitting the loop logic into two parts, the vtune results show
significant improvement (attached heapgetpage-allvis.jpg).
The test data uses TPC-H's table "orders" with a scale=20, 30 million rows.
Quan Zongliang
Attachment | Content-Type | Size |
---|---|---|
![]() |
image/jpeg | 43.0 KB |
heapgetpage.jpg | image/jpeg | 99.9 KB |
heapgetpage.patch | text/plain | 2.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2023-08-24 11:41:44 | Use FD_CLOEXEC on ListenSockets (was Re: Refactoring backend fork+exec code) |
Previous Message | Ashutosh Bapat | 2023-08-24 10:31:17 | Re: Report planning memory in EXPLAIN ANALYZE |