X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EBC769DD5F5 for ; Tue, 28 Mar 2006 06:32:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95147-07 for ; Tue, 28 Mar 2006 06:32:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id CAD839DCA72 for ; Tue, 28 Mar 2006 06:32:43 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.26.47]) by smtp.nildram.co.uk (Postfix) with ESMTP id 4B7C73399FF; Tue, 28 Mar 2006 11:32:43 +0100 (BST) Subject: Re: Printing query durations From: Simon Riggs To: Kevin Dorne Cc: pgsql-jdbc@postgresql.org In-Reply-To: <442890D9.40905@catalyst.net.nz> References: <442890D9.40905@catalyst.net.nz> Content-Type: text/plain Date: Tue, 28 Mar 2006 11:32:36 +0100 Message-Id: <1143541956.3839.329.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.097 required=5 tests=[AWL=0.097] X-Spam-Score: 0.097 X-Spam-Level: X-Archive-Number: 200603/126 X-Sequence-Number: 14907 On Tue, 2006-03-28 at 13:26 +1200, Kevin Dorne wrote: > I am having some trouble getting PostgreSQL to log durations with > statements when called through JDBC. They appear just fine with > interactive queries using psql, but the duration field does not show up > on JDBC queries. > > Is there some configuration I need to pass to the JDBC driver? These two logging formats are each produced by different parameters: > Example output from an interactive query: > LOG: duration: 109.524 ms statement: SELECT count(*) FROM transaction; This is produced by log_min_duration_statement > -1 These lines always have duration prefixes. > Example output from a JDBC query: > LOG: statement: SELECT count(*) FROM transaction; This is produced by log_statement = 'all' These lines never have durations. If you want the matching durations, use log_duration = on and read the manual to see how to match them up. The same statement can be logged twice using those options. http://www.postgresql.org/docs/8.1/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT Does that answer your query? Best Regards, Simon Riggs