Re: WIP Patch: Add a function that returns binary JSONB as a bytea

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: WIP Patch: Add a function that returns binary JSONB as a bytea
Дата
Msg-id 24251.1541128905@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: WIP Patch: Add a function that returns binary JSONB as a bytea  (Christian Ohler <ohler@shift.com>)
Ответы Re: WIP Patch: Add a function that returns binary JSONB as a bytea  (Stephen Frost <sfrost@snowman.net>)
Re: WIP Patch: Add a function that returns binary JSONB as a bytea  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-hackers
Christian Ohler <ohler@shift.com> writes:
> On Wed, Oct 31, 2018 at 7:22 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> If we're going to expose the
>> internal format, let's just change the definition of the type's binary
>> I/O format, thereby getting a win for purposes like COPY BINARY as well.

> How would this work from the driver's and application's perspective?  What
> does the driver do when receiving JSONB data?

Well, upthread it was posited that applications that read binary JSONB
data would be willing to track changes in that format (or else have no
need to, because they don't do anything with it except feed it back to the
server).  If that isn't the case, then this entire thread is a waste of
time.  I certainly don't buy that exposing the internal format via some
other mechanism than binary I/O would be a sufficient excuse for not
worrying about cross-version compatibility.

> The idea behind the proposal is to improve efficiency by avoiding
> conversions, and the most straightforward way to do that is for every layer
> to pass through the raw bytes.

This argument is, frankly, as bogus as it could possibly be.  In the first
place, you're essentially saying that ignoring version compatibility
considerations entirely is the way to avoid future version compatibility
problems.  I don't buy it.  In the second place, you already admitted
that format conversion *is* necessary; what PG finds best internally is
unlikely to be exactly what some other piece of software will want.
So we'd be better off agreeing on some common interchange format.

I'm still bemused by the proposition that that common interchange format
shouldn't be, um, JSON.  We've already seen BSON, BJSON, etc die
well-deserved deaths.  Why would jsonb internal format, which was never
for one second intended to be seen anywhere outside PG, be a better
interchange-format design than those were?

(In short, I remain unconvinced that we'd not be better off spending
our effort on making json_out faster...)

            regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Corey Huinker
Дата:
Сообщение: Re: COPY FROM WHEN condition
Следующее
От: Amit Langote
Дата:
Сообщение: Re: Getting ERROR: could not open file "base/13164/t3_16388" withpartition table with ON COMMIT