On Wed, Mar 20, 2019 at 9:20 PM Bruno Hass <bruno_h...@live.com> wrote: > I would like to optimize the jsonb key access operations. I could not find > the discussion you've mentioned, but I am giving some thought to the idea. > > Instead of storing lengths, could we dedicate the first chunk of the TOASTed > jsonb to store where each key is located? Would it be a good idea?
I don't see how that would work. To know which key is which, you'd have to store all the keys. They might not fit in the first chunk. That's the whole reason this has to be TOASTed to begin with. > You've mentioned that the current jsonb format is byte-oriented. Does that > imply that a single jsonb key value might be split between multiple chunks? Yes. You're going to need to look at the code yourself to get anywhere here... I don't have unlimited time to answer questions about it, and even if I did, you're not really going to understand how it works without studying it yourself. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company