Speedup truncations of temporary relation forks
Daniil Davydov <3danissimo@gmail.com>
From: Daniil Davydov <3danissimo@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-05-30T11:01:16Z
Lists: pgsql-hackers
Attachments
- v1-0001-Speedup-temp-table-truncation.patch (text/x-patch) patch v1-0001
Hi, For now we fully scan local buffers for each fork of the temporary relation that we want to truncate (in order to drop its buffers). It happens in the function "DropRelationBuffers". There used to be the same problem for regular tables (i.e. shared buffers) and it was fixed in commit [1] and now shared buffers are scanned only one time for those three relation forks. I suggest making the same fix for temporary relations. See attached patch. [1] 6d05086c0a79e50d8e91ed953626ec7280cd2481 BTW, I see that we call "DropRelationBuffers" separately for relation, toast table and indexes. What if we collect all this information in advance and iterate over the local/shared buffers only once? I understand that it will look kinda ugly, but it will increase performance for sure. -- Best regards, Daniil Davydov
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Speed up truncation of temporary relations.
- 78ebda66bf26 19 (unreleased) landed
-
Speedup truncations of relation forks.
- 6d05086c0a79 13.0 cited