Re: Add ZSON extension to /contrib/

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Marko Tiikkaja" <marko(at)joh(dot)to>
Subject: Re: Add ZSON extension to /contrib/
Date: 2021-05-30 08:17:27
Message-ID: 5d2da4d8-ec58-419c-8f58-fb3e45f6613d@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 25, 2021, at 22:10, Tom Lane wrote:
> Magnus Hagander <magnus(at)hagander(dot)net <mailto:magnus%40hagander.net>> writes:
> > On Tue, May 25, 2021 at 12:55 PM Aleksander Alekseev
> > <aleksander(at)timescale(dot)com <mailto:aleksander%40timescale.com>> wrote:
> >> Back in 2016 while being at PostgresPro I developed the ZSON extension [1]. The extension introduces the new ZSON type, which is 100% compatible with JSONB but uses a shared dictionary of strings most frequently used in given JSONB documents for compression.
>
> > If the extension is mature enough, why make it an extension in
> > contrib, and not instead either enhance the existing jsonb type with
> > it or make it a built-in type?
>
> IMO we have too d*mn many JSON types already. If we can find a way
> to shoehorn this optimization into JSONB, that'd be great. Otherwise
> I do not think it's worth the added user confusion.

I think the json situation is unfortunate.

If carefully designing the json type from scratch,
with all the accumulated experiences over the years from working with json and jsonb,
I think the end result would probably be quite different.

For instance, I remember Marko Tiikkaja implemented his own json type many years ago when we worked together at the same company, needing json before PostgreSQL had support for it, I remember I thought some ideas in his interface felt more natural than the built-in json type we later got.

While zson improves on efficiency, there are probably lots of other improvements in the interface that could be made as well.

Instead of trying to fix the existing built-in json type, I think it would be better to package the built-in functionality as a "json" extension, that would come pre-installed, similar to how "plpgsql" comes pre-installed.

Users who feel they are unhappy with the entire json/jsonb types could then install "zson" or some other competing json type instead. This would allow the life-cycles of legacy/deprecated versions to overlap with future versions.

Uninstallable Pre-Installed Extensions as a concept in general could perhaps be a feasible alternative to shoehorning in funtionality/optimizations in general, and also a way to avoid GUCs.

The biggest downside I see is the risk for confusion among users, since there can then be multiple competing implementations providing the same functionality. It's nice to have built-ins when all users love the built-ins.

/Joel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2021-05-30 09:09:41 psql - factor out echo code
Previous Message Pavel Stehule 2021-05-30 07:54:22 Re: security_definer_search_path GUC