Improving the heapgetpage function improves performance in common scenarios
Quan Zongliang <quanzongliang@yeah.net>
From: Quan Zongliang <quanzongliang@yeah.net>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-24T10:55:28Z
Lists: pgsql-hackers
Attachments
- heapgetpage-allvis.jpg (image/jpeg)
- heapgetpage.jpg (image/jpeg)
- heapgetpage.patch (text/plain) patch
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
Commits
-
Reduce branches in heapgetpage()'s per-tuple loop
- a97bbe1f1df9 17.0 landed
-
Remove the "snapshot too old" feature.
- f691f5b80a85 17.0 cited