pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sergei Rogovskiy <sergey@brightech.com>
To: pgsql-jdbc@postgresql.org
Subject: Speed up fixes
Date: Fri, 21 Oct 2005 10:57:08 -0500
Message-ID: <B70A61C5-C970-4910-AC50-B9751DC6F389@brightech.com> (raw)

Hello,

Unfortunately JDBC drivers for PostgreSQL are always in hot spots on  
heavy database usage. I've looked through and fixed 2-3 obvious  
performance leaks which saves 20-30% CPU usage percents for our  
application. If you are interested please review and commit to your  
source tree. See attached diff file for version 8.0.316.

Thanks,
  -- Sergei Rogovskiy
Brightech Inc.

Attachments:

speedup.patch (application/octet-stream, 3.0K) download *** ./org/postgresql/core/v3/QueryExecutorImpl.java Fri Oct 14 12:34:44 2005 --- ../postgresql-jdbc-8.0-313.src original/./org/postgresql/core/v3/QueryExecutorImpl.java Tue Feb 1 01:27:54 2005 *************** *** 59,65 **** // also break the query into separate statements. ArrayList statementList = new ArrayList(); ! ArrayList fragmentList = new ArrayList(15); boolean inQuotes = false; int fragmentStart = 0; --- 59,65 ---- // also break the query into separate statements. ArrayList statementList = new ArrayList(); ! ArrayList fragmentList = new ArrayList(); boolean inQuotes = false; int fragmentStart = 0; *************** *** 67,77 **** boolean inSingleQuotes = false; boolean inDoubleQuotes = false; ! char[] aChars = query.toCharArray(); ! int aLen = aChars.length; ! for (int i = 0; i < aLen; ++i) { ! char c = aChars[i]; switch (c) { --- 67,75 ---- boolean inSingleQuotes = false; boolean inDoubleQuotes = false; ! for (int i = 0; i < query.length(); ++i) { ! char c = query.charAt(i); switch (c) { *** ./org/postgresql/jdbc2/AbstractJdbc2Connection.java Fri Oct 14 11:35:27 2005 --- ../postgresql-jdbc-8.0-313.src original/./org/postgresql/jdbc2/AbstractJdbc2Connection.java Tue Jun 21 15:11:52 2005 *************** *** 54,62 **** // Default statement prepare threshold. protected int prepareThreshold; - - protected boolean replaceProcessingEnabled = true; - // Connection's autocommit state. public boolean autoCommit = true; // Connection's readonly state. --- 54,59 ---- *************** *** 79,85 **** //standard out if no other printwriter is set // XXX revisit: need a debug level *per connection*. - replaceProcessingEnabled = !"false".equalsIgnoreCase(info.getProperty("replaceProcessingEnabled")); int logLevel = 0; try --- 76,81 ---- *** ./org/postgresql/jdbc2/AbstractJdbc2Statement.java Fri Oct 14 11:33:44 2005 --- ../postgresql-jdbc-8.0-313.src original/./org/postgresql/jdbc2/AbstractJdbc2Statement.java Mon Oct 3 12:26:36 2005 *************** *** 106,112 **** public AbstractJdbc2Statement (AbstractJdbc2Connection c, int rsType, int rsConcurrency) throws SQLException { this.connection = c; - replaceProcessingEnabled = c.replaceProcessingEnabled; this.preparedQuery = null; this.preparedParameters = null; this.lastSimpleQuery = null; --- 106,111 ---- *************** *** 117,123 **** public AbstractJdbc2Statement(AbstractJdbc2Connection connection, String sql, boolean isCallable, int rsType, int rsConcurrency) throws SQLException { this.connection = connection; - replaceProcessingEnabled = connection.replaceProcessingEnabled; this.lastSimpleQuery = null; String parsed_sql = replaceProcessing(sql); --- 116,121 ----

view thread (5+ messages)  latest in thread

Message-ID: <B70A61C5-C970-4910-AC50-B9751DC6F389@brightech.com>
Permalink:  ../B70A61C5-C970-4910-AC50-B9751DC6F389@brightech.com/
Also on:    postgresql.org/message-id/B70A61C5-C970-4910-AC50-B9751DC6F389@brightech.com

 ·  · 

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: sergey@brightech.com
  Subject: Re: Speed up fixes
  In-Reply-To: <B70A61C5-C970-4910-AC50-B9751DC6F389@brightech.com>
  References: <B70A61C5-C970-4910-AC50-B9751DC6F389@brightech.com>

* 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