On 05/06/2009, Kenneth Cox <[email protected]> wrote: > On Fri, 05 Jun 2009 06:18:45 -0400, sebb <[email protected]> wrote: > > > > > > The funny thing is that 2.3.2 worked, but not > > > exactly as I expected. I have 2 threads (in a connection pool with max > 2 > > > connections) running 2 iterations, and in the postgres syslog output I > saw 4 > > > sequences of parse/bind/execute. I was expecting to see the "parse" > step > > > omitted on the 2nd and subsequent iterations for each thread, e.g. > > > parse/bind/execute/bind/execute. > > > > > > > > > Using a connection pool count > 0 is not recommended, as the > > connections aren't tied to particular threads. See if the same happens > > with max=0, which ensures a single connection per thread. > > > > Sadly the same happens with max=0. To simplify I set threads=1 and loop > count=2; the JDBC connection has max connections=0. And in the postgres log > I see two rounds of parse/bind/execute (below). In my own program which > uses libpq I see the parse step when I prepare the statement, and then only > bind/execute for every time I execute the prepared statement. > > So while this is working in 2.3.2, it doesn't appear to be working right. > If I get the chance I will inspect the JDBC code.
Perhaps you need to look at the JDBC driver code ?! - I just found this: http://jdbc.postgresql.org/todo.html ... Performance * [] Add statement pooling to take advantage of server prepared statements. → It's not entirely clear, but this could mean that prepared statements are not yet properly supported. Also see: http://jdbccache.projects.postgresql.org/ which may be relevant. > Jun 5 09:07:10 kc5 postgres[10529]: [2-1] LOG: duration: 0.313 ms parse > <unnamed>: select $1 > Jun 5 09:07:10 kc5 postgres[10529]: [3-1] LOG: duration: 0.097 ms bind > <unnamed>: select $1 > Jun 5 09:07:10 kc5 postgres[10529]: [3-2] DETAIL: parameters: $1 = '1' > Jun 5 09:07:10 kc5 postgres[10529]: [4-1] LOG: duration: 0.016 ms > execute <unnamed>: select $1 > Jun 5 09:07:10 kc5 postgres[10529]: [4-2] DETAIL: parameters: $1 = '1' > Jun 5 09:07:10 kc5 postgres[10529]: [5-1] LOG: duration: 0.069 ms parse > <unnamed>: select $1 > Jun 5 09:07:10 kc5 postgres[10529]: [6-1] LOG: duration: 0.030 ms bind > <unnamed>: select $1 > Jun 5 09:07:10 kc5 postgres[10529]: [6-2] DETAIL: parameters: $1 = '1' > Jun 5 09:07:10 kc5 postgres[10529]: [7-1] LOG: duration: 0.010 ms > execute <unnamed>: select $1 > Jun 5 09:07:10 kc5 postgres[10529]: [7-2] DETAIL: parameters: $1 = '1' > > Ken > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [email protected] > For additional commands, e-mail: > [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

