Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A21BC475E71 for ; Sat, 28 Dec 2002 04:31:18 -0500 (EST) Received: from aaz.links.ru (aaz.links.ru [193.125.152.37]) by postgresql.org (Postfix) with ESMTP id B2F34475C14 for ; Sat, 28 Dec 2002 04:31:17 -0500 (EST) Received: from aaz.links.ru (aaz.links.ru [193.125.152.37]) by aaz.links.ru (8.12.6/8.12.6) with ESMTP id gBS9XksQ070855; Sat, 28 Dec 2002 12:33:46 +0300 (MSK) (envelope-from babolo@aaz.links.ru) Received: (from babolo@localhost) by aaz.links.ru (8.12.6/8.12.6/Submit) id gBS9XjgJ070854; Sat, 28 Dec 2002 12:33:45 +0300 (MSK) Message-Id: <200212280933.gBS9XjgJ070854@aaz.links.ru> Subject: Re: libpq and multiple selects in a single query X-ELM-OSV: (Our standard violations) hdr-charset=KOI8-R; no-hdr-encoding=1 In-Reply-To: To: Tim Hart Date: Sat, 28 Dec 2002 12:33:45 +0300 (MSK) From: "."@babolo.ru Cc: pgsql-interfaces@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99b (25)] MIME-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/75 X-Sequence-Number: 3488 > I was musing a bit today, so don't take this to seriously... > > Would it be worth the effort to add to and/or modify the libpq API so > that multiple selects could be sent to the server in a single request > and response? Multiple selects can be sent to the server now. But as far as I unerstand only last result can be fetched: 0>pgoblin -s SELECT date(now());SELECT now() 2002-12-28 12:16:49.321118+03 pgoblin is my direct interface from command line to libpq with some scripting enhancement > Obviously, this is trivial from the command line... > select * from foo; select * from bar; You mean "from psql"? psql is complex tool with its own parser and use libpq to talk to server > But - at least as far as I understand the libpq API - only one select > can be issued using PQexec. > > In many of the apps I develop, I find that the majority of the time I > have to go to the database for a select, I have to select from several > tables. I haven't done any benchmarking, but given the rule-of-thumb > that inter-process communication incurs high overhead, I decided that Usually it is not true - compared to postmaster's cost for every query. ...or may be... Do you issue PQsetdbLogin for every PQexec? > being able to issue several statements in one call might be worth > investigating. Given the holiday season though, I haven't actually done > much work to see if PQexec actually does support this. I'd be surprised > if a client-server or n-tier app wouldn't benefit from this > functionality. -- @BABOLO http://links.ru/