Re: Printing query durations - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: Printing query durations
Date
Msg-id C5733194-C792-421C-B887-EAFF4649EEA1@fastcrypt.com
Whole thread Raw
In response to Re: Printing query durations  (Kevin Dorne <kevin@catalyst.net.nz>)
Responses Re: Printing query durations  (Oliver Jowett <oliver@opencloud.com>)
Re: Printing query durations  (Kevin Dorne <kevin@catalyst.net.nz>)
Re: Printing query durations  (Markus Schaber <schabi@logix-tt.com>)
List pgsql-jdbc
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 <hostname>

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
>


pgsql-jdbc by date:

Previous
From: Kevin Dorne
Date:
Subject: Re: Printing query durations
Next
From: Oliver Jowett
Date:
Subject: Re: Printing query durations