Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 31F2A9FB812 for ; Wed, 10 Oct 2007 17:08:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 82967-09 for ; Wed, 10 Oct 2007 17:08:52 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from flame.co.za (fmtrns.flame.co.za [160.124.170.1]) by postgresql.org (Postfix) with ESMTP id 6AD739FB75D for ; Wed, 10 Oct 2007 17:08:51 -0300 (ADT) Received: from [192.168.0.97] (vc-196-207-32-226.3g.vodacom.co.za [196.207.32.226]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by flame.co.za (Postfix) with ESMTP id D4BB6800CE for ; Wed, 10 Oct 2007 22:08:32 +0200 (SAST) Subject: Re: Performance problems with prepared statements From: Theo Kramer Reply-To: theo@flame.co.za To: pgsql-performance@postgresql.org In-Reply-To: <36e682920710101255n5760a009v8fdbf42e4599f16f@mail.gmail.com> References: <1192027540.2495.3.camel@localhost.localdomain> <36e682920710101255n5760a009v8fdbf42e4599f16f@mail.gmail.com> Content-Type: text/plain Organization: Flame Computing Enterprises cc Date: Wed, 10 Oct 2007 22:08:30 +0200 Message-Id: <1192046910.2549.25.camel@fedmac> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-4.fc7) Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.342 tagged_above=0 required=5 tests=AWL=-0.238, BAYES_50=0.001, RCVD_IN_BL_SPAMCOP_NET=1.96, RCVD_IN_SORBS_WEB=0.619 X-Spam-Level: ** X-Archive-Number: 200710/109 X-Sequence-Number: 27131 On Wed, 2007-10-10 at 15:55 -0400, Jonah H. Harris wrote: > On 10/10/07, Theo Kramer wrote: > > When running the query directly from psql it returns the required rows > > in less than 100 milli-seconds. > > > > However, when using a prepared statement from my C application on the > > above query and executing it the query duration is as follows > > ... > > Row[s] = 25, Duration = 435409.474 ms > > > > How are you timing it? Does it really take 435 seconds to complete? Fraid so - and I am running postgresql on a separate machine from the client machine - with the load going way up on the postgresql machine and the client machine remains idle until the query returns. Also the postgresql has only the one prepared statement executing during my tests. > Try the following in psql: Did that - see my previous email. -- Regards Theo