X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C13539FA2CB for ; Wed, 10 May 2006 17:29:55 -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 22117-04 for ; Wed, 10 May 2006 17:29:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id E05149FA38E for ; Wed, 10 May 2006 17:29:46 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.1/8.13.1) with ESMTP id k4AKTgtG026023 for ; Wed, 10 May 2006 17:29:42 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id k4AK42kX012672 for pgsql-admin@postgresql.org; Wed, 10 May 2006 17:04:02 -0300 (ADT) (envelope-from news) From: Chris Browne X-Newsgroups: pgsql.admin Subject: Re: Logging long queries: not all get logged Date: Wed, 10 May 2006 19:28:02 +0000 Organization: cbbrowne Computing Inc Lines: 43 Message-ID: <60mzdpaddp.fsf@dba2.int.libertyrms.com> References: <20060510163425.1873.qmail@web50305.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:dKOpCj/Aq77upMN2asrmnBfmENM= To: pgsql-admin@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/123 X-Sequence-Number: 21655 ogjunk-pgjedan@yahoo.com writes: > Hi, > > I'm running PG 8.0.3. I'm trying to catch slow queries, so I have this in postgresql.conf: > > # log queries that take more than 500 ms > log_min_duration_statement = 500 # in ms > > This does log _some_ queries that take > 500 ms to run. > However, it looks like not all queries get logged! > > And I think I spotted a pattern: > > Queries that DO get logged are: > - queries run using psql > - queries run by the java app that uses JDBC to talk to my PG database > > Queries that do NOT get logged are: > - queries run by the java app that uses Hibernate to talk to my PG database We occasionally have run into seemingly the same issue. Question: Are you certain that the queries are taking longer than 500ms for PostgreSQL to process them? Or are you merely certain that Hibernate is reporting that it took longer than that for *it* to process them? We have had Java applications which would report spurious "slow" queries any time the garbage collector had to do any significant amount of work. It could be that the garbage collector is causing Hibernate to stall while processing its logging, thereby incorrectly reporting that database queries are running slow... -- (reverse (concatenate 'string "gro.gultn" "@" "enworbbc")) http://cbbrowne.com/info/finances.html The only problem with Haiku is that you just get started and then