X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 17C7E9FB1B7 for ; Fri, 23 Jun 2006 17:40:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 08751-10 for ; Fri, 23 Jun 2006 17:40:19 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id 436CA9FA60B for ; Fri, 23 Jun 2006 17:40:20 -0300 (ADT) Received: (qmail 29169 invoked from network); 23 Jun 2006 20:40:18 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 23 Jun 2006 20:40:18 -0000 In-Reply-To: <1151094723.21238.82.camel@archimedes> References: <30b57570606211026o66e337c9s658387db0b32aeed@mail.gmail.com> <17160.1150929667@sss.pgh.pa.us> <30b57570606220116h2f216c1eue74e5cfbb41bd5bc@mail.gmail.com> <1048.1150995309@sss.pgh.pa.us> <1151003773.21238.13.camel@archimedes> <30b57570606230122s4827d2ectd470e3c4ff6ad228@mail.gmail.com> <5D40D46E-2EFE-4EC1-98B2-642C7C5E3229@fastcrypt.com> <30b57570606230523n402acc77uae9184301f44e19e@mail.gmail.com> <30b57570606230547x6a35451ag7d4a9c697533d0c9@mail.gmail.com> <847D8099-EA4C-4692-A01C-7A18B3280D68@fastcrypt.com> <1151094723.21238.82.camel@archimedes> Mime-Version: 1.0 (Apple Message framework v750) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Michael Guyver , List Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Binary tx format for an array? Date: Fri, 23 Jun 2006 16:40:16 -0400 To: Mark Lewis X-Mailer: Apple Mail (2.750) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/107 X-Sequence-Number: 15387 On 23-Jun-06, at 4:32 PM, Mark Lewis wrote: >> Hmmm maybe I should read before sending. It appears that both input, >> and output can be text. The only catch with output is that you have >> to do a describe first to get the types. This may negate any gains on >> small result sets, but certainly for large ones it would help. > > Disclaimer: this is my first real trip through the v3 protocol and the > JDBC driver source in general. So take anything below with several > grains of salt. > > As far as I can tell from reading the JDBC CVS code, the sequence for > preparing and executing a statement for the first time is: > > PREPARE (name=my_statement) > DESCRIBE STATEMENT (name=my_statement) > SYNC/FLUSH > Read Responses > > BIND (portal=my_portal) > DESCRIBE PORTAL (name=my_portal) > EXECUTE (portal=my_portal) > SYNC/FLUSH > Read Responses > > So it seems that we could do all text, mixed or all binary parameters > without adding a round trip, because we already do an extra round trip > when a statement is first prepared and we already know all of the > parameter types. Yup, you could, however the real win here is on parsing the return parameters, going from object to string is not terribly expensive. Network times are probably a red herring. > > We could do all text or all binary outputs without adding a round trip > as well, because you can globally set the output format, but to do > mixed > outputs we'd need to execute the DESCRIBE PORTAL to get the return > types, and then (not sure?) execute BIND again with different format > parameters? Yes, you can do binary results, but consider what happens if someone returns a type the driver doesn't know about ? > > -- Mark Lewis >