Re: Bound parameters on Linux are extremely slow (compared to unbound and/or Windows)

From: "Reuven M(dot) Lerner" <reuven(at)lerner(dot)co(dot)il>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>, kim+pg(at)alleroedderne(dot)adsl(dot)dk
Subject: Re: Bound parameters on Linux are extremely slow (compared to unbound and/or Windows)
Date: 2013-06-25 12:43:38
Message-ID: 51C9907A.9030108@lerner.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi, everyone. About a month ago, I e-mailed this list about a project
I'm helping which is having hugely different performance results
depending on whether they use Linux or Windows. Several list members
were nice enough to offer some answers, but then I disappeared for a
while, thanks to travel + illness + family + crazy schedules.

Just to recap: We have an application written in Java. When we build
the SQL query manually, using a StringBuilder, we get similar results on
Windows and Linux. But when we use the JDBC driver's parameter
bindings, we find wildly different performance. Specifically:

With binding:
Linux: 2,233 ms (yes, more than 2 seconds)
Windows: 232 ms

Without binding:
Linux: 176 ms
Windows: 152 ms

The two test pieces of code, which we used to benchmark performance, and
which work on the table we want to use in production, are at:

https://gist.github.com/reuven/5858095 # without bindings
https://gist.github.com/reuven/5858092 # with bindings

I believe that the tests were run on localhost, such that the client and
server were both executing on the same computer.

When we execute the query manually, via psql, we get fast results, on
both Windows and Linux. Thus, it would seem that something in the
parameter-binding code in the JDBC driver is somehow interacting poorly
with Linux.

I'm far from a Java expert, and even less of a Windows guy, so I'm not
sure what is going on here. Any suggestions as to what we should be
looking for, or tuning in the PostgreSQL and/or Windows configuration to
avoid such problems?

Thanks again for any help that you can offer.

Reuven

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2013-06-25 12:53:05 Re: Bound parameters on Linux are extremely slow (compared to unbound and/or Windows)
Previous Message Heikki Linnakangas 2013-06-25 06:49:08 Re: JDBC 4 Compliance