Re: Using JSONB directly from application

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Anthony Communier <anthony(dot)communier(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Using JSONB directly from application
Date: 2018-02-26 13:36:52
Message-ID: CAMsr+YEtamQYZ5EocsuthQCvyvmRnQrucDP6GZynPtf0gsMbuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26 February 2018 at 04:05, Anthony Communier <anthony(dot)communier(at)gmail(dot)com
> wrote:

> Hello,
>
> It would be nice if application connected to a Postrgesql database could
> send and receive JSONB in binary. It could save some useless text
> conversion. All works could be done on application side which are often
> more scalable than database itself.
>

To support this, you'd need to extract PostgreSQL's jsonb support into a C
library that could be used independently of backend server infrastructure
like 'palloc' and memory contexts, ereport(), etc. Or write a parallel
implementation.

It's one of the reasons some people questioned the wisdom of doing jsonb as
a bespoke format not using protobufs or whatever. I'm not one of them,
since I wasn't the one doing the work, and I also know how hard it can be
to neatly fit general purpose library code into the DB server where we
expect it to do little things like not abort() on malloc() failure.

If you're interested in writing such a library, I suggest proposing a broad
design for how you intend to do it here. I suspect that duplicating enough
server backend infrastructure to make the existing jsonb implementation
friendly to frontend code would be frustrating, but maybe it's not as bad
as I think. Certainly if you did such a thing, many people would thank you,
because the inability to use ereport() and elog(), PG_TRY, the List API,
etc, in FRONTEND code is a constant if minor source of irritation in
PostgreSQL development.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-02-26 13:48:52 Re: Patch: Pass IndexInfo correctly to aminsert for indexes on TOAST
Previous Message David G. Johnston 2018-02-26 13:35:37 Re: VACUUM FULL name is very confusing to some people (or to most non expert people)