pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dmp <danap@ttc-cmc.net>
To: Jeremy Whiting <jwhiting@redhat.com>
To: PostgreSQL JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: Performance improvement proposal. Removal of toLowerCase calls.
Date: Thu, 16 Jan 2014 12:21:09 -0700
Message-ID: <52D83125.2020908@ttc-cmc.net> (raw)
In-Reply-To: <52D7FE5E.3050503@redhat.com>
References: <52D7FE5E.3050503@redhat.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Jeremy Whiting wrote:
> Hi,
>   I would like to propose an optimization to improve performance in the
> jdbc driver. The performance improvement has been tested on commodity
> hardware using an industry standard Java benchmark. The overall
> benchmark metric reports an improvement in performance. Profiling using
> sampling showed calls reduced from 1100 to 0 when the benchmark workload
> is running.
>
>   The optimization will eliminate calls to the method
> toLowerCase(java.util.Locale). This in the pg-jdbc
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.findColumnIndex(java.lang.String)
> method when setting up the column index registry.
>
>   For the optimization to be enabled I suggest relying on a new system
> property. Making the existing functionality the default behaviour to
> ensure existing applications do not break when the driver is upgraded.
>
>   The change removes the call toLowerCase when putting items in the
> registry [1].  Essentially what's being proposed is removing sanitizing
> the key names. For best performance application code should pass SQL to
> the driver with column names already folded to lower case. But upper
> case names will still be matched in the second lookup [2] in the method.

****************
>   For this optimization to work this feature introduces a requirement on
> applications. To use all lower or upper case column names.
****************

This is going to break existing applications, if the requirement is to have
either upper or lowercase. I test explicitly with the MyJSQLView application
the use of mixed case column, key index names because there are applications
that used mixed case. The proper way to handle is quote to handle the mixed
case so it is store as such.

Perhaps the optimization could check for quoting then do no addition process
and store directly intact. Other wise the optimization could initiate as
proposed.

danap.

>
>   Are there other factors that might affect this optimization that need
> to be taken into consideration ?
>
> Regards,
> Jeremy Whiting
>
> Senior Software Engineer
> Red Hat
>
> [1]
> https://github.com/pgjdbc/pgjdbc/blob/REL9_3_STABLE/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java...
> [2]
> https://github.com/pgjdbc/pgjdbc/blob/REL9_3_STABLE/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java...
>



-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (17+ messages)  latest in thread

Message-ID: <52D83125.2020908@ttc-cmc.net>
Permalink:  ../52D83125.2020908@ttc-cmc.net/
Also on:    postgresql.org/message-id/52D83125.2020908@ttc-cmc.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: danap@ttc-cmc.net, jwhiting@redhat.com
  Subject: Re: Performance improvement proposal. Removal of toLowerCase calls.
  In-Reply-To: <52D83125.2020908@ttc-cmc.net>
  References: <52D7FE5E.3050503@redhat.com> <52D83125.2020908@ttc-cmc.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox