On 3/6/24 07:09, Nikita Malakhov wrote: > Hi, > > In addition to the previous message - for the toast_fetch_datum_slice > the first (seems obvious) way is to detoast the whole value, save it > to cache and get slices from it on demand. I have another one on my > mind, but have to play with it first. >
What if you only need the first slice? In that case decoding everything will be a clear regression. IMHO this needs to work like this: 1) check if the cache already has sufficiently large slice detoasted (and use the cached value if yes) 2) if there's no slice detoasted, or if it's too small, detoast a sufficiently large slice and store it in the cache (possibly evicting the already detoasted slice) regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company