Re: Shared detoast Datum proposal
От | Tomas Vondra |
---|---|
Тема | Re: Shared detoast Datum proposal |
Дата | |
Msg-id | 233cce7b-d9ae-4605-9b76-1f3b98cbc7f0@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: Shared detoast Datum proposal (Nikita Malakhov <hukutoc@gmail.com>) |
Ответы |
Re: Shared detoast Datum proposal
|
Список | pgsql-hackers |
On 3/5/24 10:03, Nikita Malakhov wrote: > Hi, > > Tomas, sorry for confusion, in my previous message I meant exactly > the same approach you've posted above, and came up with almost > the same implementation. > > Thank you very much for your attention to this thread! > > I've asked Andy about this approach because of the same reasons you > mentioned - it keeps cache code small, localized and easy to maintain. > > The question that worries me is the memory limit, and I think that cache > lookup and entry invalidation should be done in toast_tuple_externalize > code, for the case the value has been detoasted previously is updated > in the same query, like > I haven't thought very much about when we need to invalidate entries and where exactly should that happen. My patch is a very rough PoC that I wrote in ~1h, and it's quite possible it will have to move or should be refactored in some way. But I don't quite understand the problem with this query: > UPDATE test SET value = value || '...'; Surely the update creates a new TOAST value, with a completely new TOAST pointer, new rows in the TOAST table etc. It's not updated in-place. So it'd end up with two independent entries in the TOAST cache. Or are you interested just in evicting the old value simply to free the memory, because we're not going to need that (now invisible) value? That seems interesting, but if it's too invasive or complex I'd just leave it up to the LRU eviction (at least for v1). I'm not sure why should anything happen in toast_tuple_externalize, that seems like a very low-level piece of code. But I realized there's also toast_delete_external, and maybe that's a good place to invalidate the deleted TOAST values (which would also cover the UPDATE). > I've added cache entry invalidation and data removal on delete and update > of the toasted values and am currently experimenting with large values. > I haven't done anything about large values in the PoC patch, but I think it might be a good idea to either ignore values that are too large (so that it does not push everything else from the cache) or store them in compressed form (assuming it's small enough, to at least save the I/O). regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: