Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 47A542E4072 for ; Thu, 13 Dec 2007 17:58:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 97769-06-2 for ; Thu, 13 Dec 2007 17:58:13 -0400 (AST) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.185]) by postgresql.org (Postfix) with ESMTP id 5E1FD2E4042 for ; Thu, 13 Dec 2007 17:58:13 -0400 (AST) Received: by mu-out-0910.google.com with SMTP id i10so1372452mue.3 for ; Thu, 13 Dec 2007 13:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=l0jsxnmu+ayqSvzYr8adeAn9UE0GGoY1no9Rs7t5Wig=; b=mh4cQiBi9M/AK4mt4LzVZ+fXKYAl/lbWqfRMJpH8+z5PRD6eA+OlHBhBkVkxIxke8gojUvVsuo6ViBPW0gso/pAOECocacVj9CSdv10sANVoRE779dT0QVs8fCqbpKYk3K4w61w3SDo01O3Arf21Z5Emxu4fF6lWdR8yn2kPFI8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EBdQQuyqPdhzq4AGL1/f6kM3J+p+AJ6wlPGpsrc1UVDkwHDZO/q99ghjWUCg+S6guraQueURO9LNfR39vQdiQBdO79TCllxkU9jfKIvt6+t9ovQFGHhBHUkuCYPNeLZsG1gTei06UnZja9eF5t7xEOMi7PZ20cnfeYQ21wPf1N8= Received: by 10.82.171.16 with SMTP id t16mr6308446bue.11.1197583091208; Thu, 13 Dec 2007 13:58:11 -0800 (PST) Received: by 10.82.120.6 with HTTP; Thu, 13 Dec 2007 13:58:10 -0800 (PST) Message-ID: <1d4e0c10712131358m4bbc3f57t7e33c6c8ad2b3710@mail.gmail.com> Date: Thu, 13 Dec 2007 22:58:10 +0100 From: "Guillaume Smet" To: "Tom Duffey" Subject: Re: Slow query after upgrades Cc: pgsql-jdbc@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3EB52707-C945-43D6-9B3F-15F3B228D6F6@techbydesign.com> <4761A221.80604@opencloud.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/97 X-Sequence-Number: 17952 On Dec 13, 2007 10:28 PM, Tom Duffey wrote: > The odd thing is that the same query is used in other components of > the application and we have not noticed any issues. This led me to > believe that something about this particular piece is causing the > problem, possibly external to the query or the JDBC driver. Running > the query in psql, for example, doesn't seem slow at all. So maybe > it's not a PostgreSQL problem at all but I thought someone might have > seen this and have some insight into where I should look. Usual questions: did you analyze your database after loading the dump? One of the problem you can meet is that the new driver uses protocol v3 by default, which means that your query are prepared and planned without the value of the parameters as it was the case using v2 of the protocol. This can lead in bad plans in specific cases. You may consider using protocol v2 again if it's your problem by adding protocolVersion=2 to your JDBC connection URL. > Is there some logging I can use to compare what is happening on the > server side when this query is run by the app with the problem vs. > something else (psql or another of our applications)? Use log_min_duration_statement in your postgresql.conf (0 if you want to log every queries). -- Guillaume