-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance / memory usage fix: do not allocate memory in pg_tde_slot
Until now, for some reason we allocated memory for each decrypted tuple in pg_tde_slot, and only freed all that memory when the transaction ended. This caused two issues: * palloc takes time, and the many small pallocs resulted in a significant performance drop in scans * sequential scans could potentially allocate memory to the entire table, requiring way too much memory for large tables This allocation is most likely a leftover from before we even used slots, and handled selects differently. With slots, we don't need them at all, as slots are not expected to handle multiple tuples at the same time, only the last one. This commit removes the palloc completely, and instead adds a single BLCKSZ array to the slot structure, which can hold any size of decrypted tuple. To be safe, it also disables the get tuple function, forcing the core code to use copy instead when needed. This change results in: 1. no "memory spike" during sequential scans 2. ~1.55x overhead instead of ~2.2x (The TODO in slot_copytuple will be addressed in a separate commit)
- Loading branch information
Showing
2 changed files
with
25 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters