Re: Parse more than bind and execute when connect to database by jdbc

Lists: pgsql-hackers
From: wangshuo(at)highgo(dot)com(dot)cn
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Parse more than bind and execute when connect to database by jdbc
Date: 2013-11-18 02:02:12
Message-ID: 02db4b9663657f959efe3aa9413ccf71@highgo.com.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi hackers,

I used jdbc to connect to PostgreSQL ,and I found parse
nearly three
times of bind and execute.Is is normaly? What factors may
cause this result?

The OS is CentOS 5. The PG is 9.0.9. The JDBC is 9.2.

Yours,
Wang Shuo
HighGo Software Co.,Ltd.
November 18, 2013


From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: wangshuo(at)highgo(dot)com(dot)cn
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parse more than bind and execute when connect to database by jdbc
Date: 2013-11-18 03:39:23
Message-ID: CAA4eK1+FDe9V0B2Ue15=+QQc=L49LP0gP33S2NE7q9KqM=yzWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Nov 18, 2013 at 7:32 AM, <wangshuo(at)highgo(dot)com(dot)cn> wrote:
> Hi hackers,
>
> I used jdbc to connect to PostgreSQL ,and I found parse nearly three
> times of bind and execute.Is is normaly?
Actually bind and execute should be more than parse. Have you
confirmed that by enabling Log/Debug messages on server or you are
referring to JDBC log?

> What factors may cause this result?
I am really not sure of JDBC, but from Libpq or general concept wise,
it can happen only if someone does call parse multiple times, but then
execute only few of the statements. I think you might need to narrow
down the problem by having less number of queries in your JDBC
application. If possible start by having only 1 or 2 queries and then
see how many times parse,bind,execute gets called.

> The OS is CentOS 5. The PG is 9.0.9. The JDBC is 9.2.
>

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


From: wangshuo(at)highgo(dot)com(dot)cn
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parse more than bind and execute when connect to database by jdbc
Date: 2013-11-18 05:22:33
Message-ID: df7d2551ffeacc955c5ba7bbddb28968@highgo.com.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2013-11-18 11:39, Amit Kapila wrote:
> On Mon, Nov 18, 2013 at 7:32 AM, <wangshuo(at)highgo(dot)com(dot)cn> wrote:
>> Hi hackers,
>>
>> I used jdbc to connect to PostgreSQL ,and I found parse
>> nearly three
>> times of bind and execute.Is is normaly?
> Actually bind and execute should be more than parse. Have you
> confirmed that by enabling Log/Debug messages on server or you are
> referring to JDBC log?
>

Thanks for your reply.

This is the Log/Debug messages.
Some configuration options are as follows:

log_min_duration_statement = 0'
log_statement = 'all'
log_line_prefix = '%t [%p]: [%l-1] db=%d,user=%u [%x]'
logging_collector = on

>> What factors may cause this result?
> I am really not sure of JDBC, but from Libpq or general concept wise,
> it can happen only if someone does call parse multiple times, but
> then
> execute only few of the statements.

I do agree with you. But I don't know what query can call parse
multiple times.
Could you give me more information or example about this case?

Wang Shuo
HighGo Software Co.,Ltd.
November 18, 2013