Hi! Here's a slightly improved version of patch Tomas provided above (v2), with cache invalidations and slices caching added, still as PoC.
The main issue I've encountered during tests is that when the same query retrieves both slices and full value - slices, like substring(t,...) the order of the values is not predictable, with text fields substrings are retrieved before the full value and we cannot benefit from cache full value first and use slices from cached value. Yet the cache code is still very compact and affects only sources related to detoasting. Tomas, about HASH_ENTER - according to comments it could throw an OOM error, so I've changed it to HASH_ENTER_NULL to avoid new errors. In this case we would just have the value not cached without an error. -- Regards, Nikita Malakhov Postgres Professional The Russian Postgres Company https://postgrespro.ru/
0001-toast-cache-v3.patch
Description: Binary data