Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id E2230B5DC4D for ; Mon, 27 Jun 2011 15:07:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 27008-03-7 for ; Mon, 27 Jun 2011 18:07:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.softperience.eu (static-ip-217-118-26-141.inaddr.intergenia.de [217.118.26.141]) by mail.postgresql.org (Postfix) with ESMTP id 7D2F6B5DCD2 for ; Mon, 27 Jun 2011 15:06:12 -0300 (ADT) Received: from Inbox (188.146.87.210.nat.umts.dynamic.t-mobile.pl [188.146.87.210]) by mail.softperience.eu (Postfix) with ESMTPA id 7B262C000B1; Mon, 27 Jun 2011 20:06:09 +0200 (CEST) MIME-Version: 1.0 content-class: From: Radoslaw Smogura Subject: Re: bytea performance tweak Date: Mon, 27 Jun 2011 20:06:08 +0200 Importance: normal X-Priority: 3 To: Maciek Sakrejda , Florian Weimer CC: Andreas Schmitz , Oliver Jowett , Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Message-Id: <20110627180613.7D2F6B5DCD2@mail.postgresql.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/64 X-Sequence-Number: 21988 I started with different assumption - encode everything in binary, eventual= ly fix server. As the result, one huge barrier was closed - binary encoding= for void type. Actually only aclitem, but it's less important, so some = 9.x servers should allow implementing of binary.=0D=0DProblems are with tim= estamp encoding , here you can't send unknown, and I don't think it will= be fixed in any way.=0D=0DMy work with binary went on greater sea, as I ad= ded JDBC4 exceptions, support for struct types, changed how input is handle= d to allow to download large datums, moved to maven and removed some Java.i= n =0D=0DRegards,=0DRadek=0A= =0A= -----Original Message----- From: Maciek Sakrejda Sent: 27 czerwca 2011 18:51 To: Florian Weimer Cc: Andreas Schmitz; Oliver Jowett; pgsql-jdbc@postgresql.org Subject: Re: [JDBC] bytea performance tweak >> 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. 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. > A way to tell PostgreSQL to always send some [types] in binary format > would solve this, though. (I assume you meant "types" not "times") 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. 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? --- Maciek Sakrejda | System Architect | Truviso 1065 E. Hillsdale Blvd., Suite 215 Foster City, CA 94404 (650) 242-3500 Main www.truviso.com --=20 Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc