Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y6O2X-0002HU-Hk for pgsql-jdbc@arkaria.postgresql.org; Wed, 31 Dec 2014 18:30:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y6O2V-0005wg-Kv for pgsql-jdbc@arkaria.postgresql.org; Wed, 31 Dec 2014 18:30:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y6O2T-0005wX-Jn for pgsql-jdbc@postgresql.org; Wed, 31 Dec 2014 18:30:33 +0000 Received: from mail-am1on0610.outbound.protection.outlook.com ([2a01:111:f400:fe00::610] helo=emea01-am1-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y6O2J-0001ex-Ct for pgsql-jdbc@postgresql.org; Wed, 31 Dec 2014 18:30:31 +0000 Received: from AM2PR07MB0659.eurprd07.prod.outlook.com (25.160.55.150) by AM2PR07MB0659.eurprd07.prod.outlook.com (25.160.55.150) with Microsoft SMTP Server (TLS) id 15.1.49.12; Wed, 31 Dec 2014 18:29:35 +0000 Received: from AM2PR07MB0659.eurprd07.prod.outlook.com ([25.160.55.150]) by AM2PR07MB0659.eurprd07.prod.outlook.com ([25.160.55.150]) with mapi id 15.01.0049.002; Wed, 31 Dec 2014 18:29:35 +0000 From: Mikko Tiihonen To: Dave Cramer , Christopher BROWN CC: List Subject: Re: Postgresql 9.4 / JSONB / JDBC Thread-Topic: [JDBC] Postgresql 9.4 / JSONB / JDBC Thread-Index: AQHQHDnH9nUljAioMUe2D0ONGA6oRJymZlCAgAAaTgCAA5V1Dg== Date: Wed, 31 Dec 2014 18:29:35 +0000 Message-ID: <1420050573364.92662@nitorcreations.com> References: , In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [62.78.161.93] authentication-results: spf=none (sender IP is ) smtp.mailfrom=Mikko.Tiihonen@nitorcreations.com; x-microsoft-antispam: BCL:0;PCL:0;RULEID:;SRVR:AM2PR07MB0659; x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:;SRVR:AM2PR07MB0659; x-forefront-prvs: 0442E569BC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(164054003)(189002)(199003)(24454002)(19580405001)(64706001)(31966008)(106356001)(105586002)(40100003)(19627405001)(102836002)(16236675004)(20776003)(2900100001)(4396001)(15975445007)(68736005)(19617315012)(19580395003)(2950100001)(62966003)(106116001)(54356999)(66066001)(97736003)(2656002)(86362001)(120916001)(92566001)(99396003)(117636001)(87936001)(50986999)(36756003)(16601075003)(122556002)(76176999)(77156002)(21056001)(46102003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR07MB0659; H:AM2PR07MB0659.eurprd07.prod.outlook.com; FPR:; SPF:None; MLV:sfv; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: nitorcreations.com does not designate permitted sender hosts) Content-Type: multipart/alternative; boundary="_000_142005057336492662nitorcreationscom_" MIME-Version: 1.0 X-OriginatorOrg: nitorcreations.com X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Dec 2014 18:29:35.3702 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 687fa259-bdca-476c-881e-e3ab9207b086 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR07MB0659 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org --_000_142005057336492662nitorcreationscom_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Last time I checked (few months ago), the postgresql jsonb binary format wa= s just a extra 4 byte version header followed by text json data. So basical= ly the binary jsonb format was slower than text format. And since there is = no official plan on how to modify the binary formats without breaking backw= ards compatibility it most likely will stay that way. Having a proper binary encoding for jsonb would speed up parsing on both se= rver and client side. -Mikko ________________________________ From: pgsql-jdbc-owner@postgresql.org on = behalf of Dave Cramer Sent: 29 December 2014 13:42 To: Christopher BROWN Cc: List Subject: Re: [JDBC] Postgresql 9.4 / JSONB / JDBC Yes, we can pull the data from the server in binary. After that though we h= ave to convert it to text Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca On 29 December 2014 at 05:08, Christopher BROWN > wrote: Hello, Regarding my previous messages on this subject (JSONB support in the Postgr= esql JDBC driver), one assumption I'm making is that the driver might be ab= le to stream the JSON data more efficiently that just throwing a chunk of t= ext onto the wire... as text isn't the most efficient way of encoding numbe= rs, booleans, and nulls. How does the native network protocol of Postgresql actually transfer such d= ata? Is there an opportunity for sending the data efficiently? Personally= for some of my applications, I'm able to use Jackson's "Smile" binary JSON= format, although I doubt that the Postgresql server would understand it or= want to implement it (I don't know if it could be considered a standard, e= ven if it's specified -- http://wiki.fasterxml.com/SmileFormatSpec). -- Christopher On 20 December 2014 at 10:44, Christopher BROWN > wrote: Hello, I'm new to this list, and have tried searching both the mailing list archiv= es, and internet in general, for information on how to use the new JSONB da= ta type with JDBC. Found almost nothing in the mailing list archives, and = internet searches "helpfully" assume I've misspelled "json" and give me res= ults that are unrelated or refer to the basic "JSON" type from older Postgr= esql versions. How can this type be used, with simple "flat" key-value collections (maps),= with tree-like maps-of-maps, and (ideally) with JSON APIs such as Jackson = JSON API? Is it possible? Is it already described somewhere that I missed? Thanks, Christopher --_000_142005057336492662nitorcreationscom_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Last time I checked (few months ago), the postgresql jsonb binary format= was just a extra 4 byte version header followed by text json data. So basi= cally the binary jsonb format was slower than text format. And since there = is no official plan on how to modify the binary formats without breaking backwards compatibility it most likely= will stay that way.


Having a proper binary encoding for jsonb would speed up parsing on both= server and client side.


-Mikko


From: pgsql-jdbc-owner@pos= tgresql.org <pgsql-jdbc-owner@postgresql.org> on behalf of Dave Crame= r <pg@fastcrypt.com>
Sent: 29 December 2014 13:42
To: Christopher BROWN
Cc: List
Subject: Re: [JDBC] Postgresql 9.4 / JSONB / JDBC
 
Yes, we can pull the data from the server in binary. After= that though we have to convert it to text

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca=

On 29 December 2014 at 05:08, Christopher BROWN = <brown@reflexe.fr<= /a>> wrote:
Hello,

Regarding my previous messages on this subject (JSONB support in the P= ostgresql JDBC driver), one assumption I'm making is that the driver might = be able to stream the JSON data more efficiently that just throwing a chunk= of text onto the wire... as text isn't the most efficient way of encoding numbers, booleans, and nulls.


--_000_142005057336492662nitorcreationscom_--