X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1C8C6528C5 for ; Wed, 18 May 2005 11:39:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40925-03 for ; Wed, 18 May 2005 14:39:28 +0000 (GMT) Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id C6723528B0 for ; Wed, 18 May 2005 11:39:27 -0300 (ADT) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 18 May 2005 09:39:30 -0500 Subject: Re: SQL logging (log_min_duration_statement) not working From: Scott Marlowe To: Pallav Kalva Cc: pgsql-admin@postgresql.org In-Reply-To: <428B4487.8010702@deg.cc> References: <428B4487.8010702@deg.cc> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1116427170.31821.10.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 18 May 2005 09:39:30 -0500 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/236 X-Sequence-Number: 17665 On Wed, 2005-05-18 at 08:35, Pallav Kalva wrote: > Hi Everybody, > > > I am having problems with logging long running SQL in the log file. > I have set log_min_duration_statement = 5000 (5secs) and it is not > logging sql statements that took over 5 secs and this is only from > queries generated by Hibernate . here is a sample query from hibernate : > > ----------------------------------------------------------------------------------------- > select listingadd1_.addressid as col_0_0_ > from listing.listing listing0_, listing.address listingadd1_ > where ((select count(taxrolls2_.fkaddressid) > from listing.taxroll taxrolls2_ > where listingadd1_.addressid=taxrolls2_.fkaddressid)=0 ) > and(listing0_.fkbestaddressid=listingadd1_.addressid ) > and(listing0_.entrydate>$1 ) > order by listingadd1_.addressid asc > -------------------------------------------------------------------------------------------- > > This above query take more than 5 secs to run and it wont get logged , > where as all other queries which are not generated by Hibernate are > logged. Is this expected behavior ? am I missing something else ? > Please advice. Are you sure it's taking more than 5 seconds to run, not that it's taking <5 seconds to run and >5 seconds to return the data. I'm pretty sure the time it takes to ship out the data isn't counted in the time used to decide whether to log the query or not by the postmaster. I.e. what does explain analyze QUERY HERE say about the execution time?