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 C789111F644E for ; Tue, 28 Mar 2006 21:50:30 -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 58418-01 for ; Tue, 28 Mar 2006 21:50:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id 3BAB411F640B for ; Tue, 28 Mar 2006 21:50:27 -0400 (AST) Received: (qmail 22887 invoked from network); 29 Mar 2006 01:50:27 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 29 Mar 2006 01:50:27 -0000 In-Reply-To: <4429E5BC.9050604@catalyst.net.nz> References: <442890D9.40905@catalyst.net.nz> <1143541956.3839.329.camel@localhost.localdomain> <4429E5BC.9050604@catalyst.net.nz> Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-jdbc@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Printing query durations Date: Tue, 28 Mar 2006 20:50:26 -0500 To: Kevin Dorne X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.129 required=5 tests=[AWL=0.129] X-Spam-Score: 0.129 X-Spam-Level: X-Archive-Number: 200603/134 X-Sequence-Number: 14915 Kevin, Well, the server doesn't really know the difference between a query from jdbc vs a query from psql. The only difference is how they connect. psql usually connects to a unix domain socket, whereas jdbc connects via a tcpip socket. Even this behaviour can be changed in psql by specifying -h What is min_duration set to. Is it possible that the queries are faster through JDBC. Possibly because the server already has done the count? Try setting min_duration to something ridiculously small. Dave On 28-Mar-06, at 8:41 PM, Kevin Dorne wrote: > Simon Riggs wrote: > [...] >>> 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. > > Yes, that's what I would expect. My problem is that this setting only > logs queries via psql; queries via JDBC don't get logged at all. > >>> 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. > > Yes, I've done that. Again, I can get those durations to appear for > queries via psql, but not via JDBC. > > [...] > By the way, the JDBC driver I'm using (thanks Markus Schaber for the > tip) is "PostgreSQL 8.0 JDBC3 with SSL (build 311)". > > -k >