Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 23ACCB5D803 for ; Mon, 27 Jun 2011 20:50:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 91979-04 for ; Mon, 27 Jun 2011 23:50:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.lat-lon.de (mail.lat-lon.de [178.63.90.186]) by mail.postgresql.org (Postfix) with ESMTP id 79DA2B5DBC4 for ; Mon, 27 Jun 2011 20:50:07 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.lat-lon.de (Postfix) with ESMTP id 6DEC6198003; Tue, 28 Jun 2011 01:50:06 +0200 (CEST) X-Virus-Scanned: by amavisd-new at lat-lon.de Received: from mail.lat-lon.de ([127.0.0.1]) by localhost (mail.lat-lon.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IzFxzqyrP-xA; Tue, 28 Jun 2011 01:49:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.lat-lon.de (Postfix) with ESMTP id CC0D4198005; Tue, 28 Jun 2011 01:49:57 +0200 (CEST) Received: from localhost (ip-95-222-152-123.unitymediagroup.de [95.222.152.123]) (Authenticated sender: schmitz@lat-lon.de) by mail.lat-lon.de (Postfix) with ESMTP id 9A974198003; Tue, 28 Jun 2011 01:49:57 +0200 (CEST) Date: Tue, 28 Jun 2011 01:49:57 +0200 From: Andreas Schmitz To: Maciek Sakrejda Cc: Florian Weimer , Oliver Jowett , pgsql-jdbc@postgresql.org Subject: Re: bytea performance tweak Message-ID: <20110627234957.GA2653@summalogicae.occamlabs.local> References: <20110621130713.GB3919@summalogicae.occamlabs.local> <20110622141711.GA2652@summalogicae.occamlabs.local> <20110623100616.GA14152@summalogicae.occamlabs.local> <82pqlzs7gt.fsf@mid.bfk.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/70 X-Sequence-Number: 21994 --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Maciek Sakrejda wrote: Hi, > >> Is there a timeline for fully supporting the binary protocol? > > > > A PostgreSQL installation can contain user-defined types with a custom > > binary format, so this will not work with all databases anyway. >=20 > Having to read unknown types in text mode is not any easier if you're > going to do something interesting with them. In either case, the > protocol provides a way to read the type payload off the wire (so, > e.g., a column with a type you can't read won't "mess up" the whole > result set), but it's up to you to process those bytes. As Vitalii > stated, something like PGObject is probably the right way to handle > this. >=20 > > A way to tell PostgreSQL to always send some [types] in binary format > > would solve this, though. >=20 > (I assume you meant "types" not "times") >=20 > Yep, that would be nice. There are per-*column* output facilities in > the protocol, but not per-type. It's possible to ask the server for > the columns in a query before you commit to output types, but that > involves an extra round trip which won't be worth it most of the time > (still, it could be worth it if you're doing something that outputs a > lot of rows with far leaner binary representations for some data > types). Perhaps per-statement encoding choice might be the right > compromise, although that smells like a niche use case. >=20 > What's the current state of the binary patch? The wiki ( > http://wiki.postgresql.org/wiki/JDBC-BinaryTransfer ) doesn't say. > With a brief look at the list archives, the last activity I see is a > completely new patch submitted by Rados=C5=82aw Smogura, but that > discussion peters out. That discussion implies we want a solution to > the "which-types-to-encode-how" problem, but realistically, if we want > that, we won't have binary support until the protocol changes to allow > per-type encoding selection. Would a polished patch with > all-or-nothing connection-flag-level binary support be acceptable? so it seems to me that switching to the binary protocol is probably going to be hard, without server side support. What about just applying my patch in the meantime, including Oliver's fix of course? Best regards, Andreas --Kj7319i9nmIyA2yE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk4JFyUACgkQ737OVr+Ru7rDdgCgyVa+G0rOJLJD/GxiOKH8kY1Q hqcAmwdUj/4t07WJIxovy35AdxL0g4EK =OCQ5 -----END PGP SIGNATURE----- --Kj7319i9nmIyA2yE--