Re: Best way to keep track of a sliced TOAST

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Bruno Hass <bruno_hass(at)live(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Best way to keep track of a sliced TOAST
Date: 2019-03-21 18:45:15
Message-ID: CA+Tgmob2TxV9BTSwyDYsigHGK87bH3nN_ANhkO8GN4owNOrutg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 20, 2019 at 9:20 PM Bruno Hass <bruno_hass(at)live(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-03-21 18:47:43 Re: [proposal] Add an option for returning SQLSTATE in psql error message
Previous Message Simon Riggs 2019-03-21 18:25:53 Re: Connections hang indefinitely while taking a gin index's LWLock buffer_content lock