Protocol buffer support for Postgres

From: 陈天舟 <tianzhouchen(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Protocol buffer support for Postgres
Date: 2016-04-26 06:06:11
Message-ID: CAMr4XPLDTrL1b=GrnwhhEjQJE5KdPGL+BrA-yvMMc0dGYb9hCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I am interested in adding Protocol Buffer support for Postgres. Protocol
Buffer occupies less space than JSON. More importantly, it has schema and
is forward/backward compatible. All these make it a very good format for
persistency.

Here are two rough ideas I have right now:

Approach 1:

Creating a datatype "PROTOBUF" similar as "JSON" and implement all the
similar support (e.g. indexing) as done for "JSON" Type.
(1) Since each protocol buffer column requires a schema. I am not sure
where is the best place to store that schema info. Should it be in a
CONSTRAINT (but I am not able to find the doc referring any custom
constraint), or should it be in the COMMENT or somewhere else?
(2) The input/output will be already serialized protocol buffer. The
protocol buffer schema will be used to validate the column value when
storing/retrieving the data. It may be possible to skip the check upon
retrieving, instead the check can be done anytime the column schema is
changed.

Approach 2:

Still creating a datatype "PROTOBUF", but internally it uses "JSON" type.
So PROTOBUF is just a wrapper type doing the conversion and schema
validation on the fly. The benefit of this is it can leverage the JSON
support. The downside is it can only support the common features available
in both Protocol Buffer and JSON. e.g. Protocol Buffer annotation is a
quite useful feature which is not available in JSON.

I would like to hear some thoughts about having Protocol Buffer for
Postgres as well as the approach tackling it.

Thanks
Tianzhou

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2016-04-26 06:23:51 Re: Protocol buffer support for Postgres
Previous Message Ashutosh Sharma 2016-04-26 05:24:48 Parallel SAFE information missing in CREATE OR REPLACE FUNCTION definition