RE: [Patch] Optimize dropping of relation buffers using dlist
k.jamison@fujitsu.com <k.jamison@fujitsu.com>
From: "k.jamison@fujitsu.com" <k.jamison@fujitsu.com>
To: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>, 'Robert Haas' <robertmhaas@gmail.com>
Date: 2020-03-25T06:24:32Z
Lists: pgsql-hackers
Attachments
- v7-Optimize-dropping-of-relation-buffers-using-dlist.patch (application/octet-stream) patch v7
Hi, I know this might already be late at end of CommitFest, but attached is the latest version of the patch. The previous version only includes buffer invalidation improvement for VACUUM. The new patch adds the same routine for TRUNCATE WAL replay. In summary, this patch aims to improve the buffer invalidation process of VACUUM and TRUNCATE. Although it may not be a common use case, our customer uses these commands a lot. Recovery and WAL replay of these commands can take time depending on the size of database buffers. So this patch optimizes that using the newly-added auxiliary cache and doubly-linked list on the shared memory, so that we don't need to scan the shared buffers anymore. As for the performance and how it affects the read-only workloads. Using pgbench, I've kept the overload to a minimum, less than 1%. I'll post follow-up results. Although the additional hash table utilizes shared memory, there's a significant performance gain for both TRUNCATE and VACUUM from execution to recovery. Regards, Kirk Jamison
Commits
-
Fix size overflow in calculation introduced by commits d6ad34f3 and bea449c6.
- 519e4c9ee21a 14.0 landed
-
Optimize DropRelFileNodesAllBuffers() for recovery.
- bea449c635c0 14.0 landed
-
Optimize DropRelFileNodeBuffers() for recovery.
- d6ad34f3410f 14.0 landed
-
Cache smgrnblocks() results in recovery.
- c5315f4f4484 14.0 cited
-
Add a check to prevent overwriting valid data if smgrnblocks() gives a
- ffae5cc5a602 8.2.0 cited