Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 4041D9FB38F for ; Thu, 11 Oct 2007 07:33:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 72839-08 for ; Thu, 11 Oct 2007 07:33:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from flame.co.za (ns.flame.co.za [160.124.170.1]) by postgresql.org (Postfix) with ESMTP id B14229FB38B for ; Thu, 11 Oct 2007 07:33:44 -0300 (ADT) Received: from [192.168.0.161] (unknown [196.209.202.75]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by flame.co.za (Postfix) with ESMTP id 5F5B88039E for ; Thu, 11 Oct 2007 12:33:29 +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: <470DE90E.2060605@archonet.com> References: <1192027540.2495.3.camel@localhost.localdomain> <470CE918.4060608@dalibo.com> <1192044840.2549.21.camel@fedmac> <470DE90E.2060605@archonet.com> Content-Type: text/plain Organization: Flame Computing Enterprises cc Date: Thu, 11 Oct 2007 12:33:18 +0200 Message-Id: <1192098798.2507.26.camel@localhost.localdomain> 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-Archive-Number: 200710/126 X-Sequence-Number: 27148 On Thu, 2007-10-11 at 10:12 +0100, Richard Huxton wrote: > Theo Kramer wrote: > > > > So I suspect that there is something more fundamental here... > > OK, so there must be something different between the two scenarios. It > can only be one of: > 1. Query > 2. DB Environment (user, locale, settings) > 3. Network environment (server/client/network activity etc) I suspect that it could also be in the way the libpq PQprepare(), and PQexecPrepared() are handled... as opposed to the way PREPARE and EXECUTE are handled. > > Are you sure you have the parameter types correct in your long-running > query? Yes - the problem surfaced during a going live session on an 80 user system... and we had to roll back to the previous system in a hurry. This was a part of the application that had missed testing, but I have had other reports from some of my other systems where this appears to be a problem but not of the magnitude that this one is. In any case I have managed to reproduce it in my test environment with configuration settings the same. > Try setting log_min_duration_statement=9000 or so to capture > long-running queries. Thanks - will give that a try. > > Make sure the user and any custom settings are the same. Compare SHOW > ALL for both ways. > You've said elsewhere you've ruled out the network environment, so > there's not point worrying about that further. It is definitely not a network problem - ie. the postgresql server load goes way up when this query is run. -- Regards Theo