pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedSpeed up fixes
5+ messages / 3 participants
[nested] [flat]
* Speed up fixes
@ 2005-10-21 15:57 Sergei Rogovskiy <sergey@brightech.com>
2005-10-24 18:20 ` Re: Speed up fixes Dave Cramer <pg@fastcrypt.com>
2005-10-24 19:49 ` Re: Speed up fixes Dave Cramer <pg@fastcrypt.com>
0 siblings, 2 replies; 5+ messages in thread
From: Sergei Rogovskiy @ 2005-10-21 15:57 UTC (permalink / raw)
To: pgsql-jdbc
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 ----
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Speed up fixes
2005-10-21 15:57 Speed up fixes Sergei Rogovskiy <sergey@brightech.com>
@ 2005-10-24 18:20 ` Dave Cramer <pg@fastcrypt.com>
1 sibling, 0 replies; 5+ messages in thread
From: Dave Cramer @ 2005-10-24 18:20 UTC (permalink / raw)
To: Sergei Rogovskiy <sergey@brightech.com>; +Cc: pgsql-jdbc
Interestingly we've had two people provide exactly (more or less )
the same patch in as many weeks.
thanks
Dave
On 21-Oct-05, at 11:57 AM, Sergei Rogovskiy wrote:
> 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.
>
>
> <speedup.patch>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Speed up fixes
2005-10-21 15:57 Speed up fixes Sergei Rogovskiy <sergey@brightech.com>
@ 2005-10-24 19:49 ` Dave Cramer <pg@fastcrypt.com>
2005-10-24 20:31 ` Re: Speed up fixes Oliver Jowett <oliver@opencloud.com>
1 sibling, 1 reply; 5+ messages in thread
From: Dave Cramer @ 2005-10-24 19:49 UTC (permalink / raw)
To: Sergei Rogovskiy <sergey@brightech.com>; +Cc: pgsql-jdbc
Sergei.
I understand everything except the removal of replaceProcessingEnabled ?
please explain.
Dave
On 21-Oct-05, at 11:57 AM, Sergei Rogovskiy wrote:
> 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.
>
>
> <speedup.patch>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Speed up fixes
2005-10-21 15:57 Speed up fixes Sergei Rogovskiy <sergey@brightech.com>
2005-10-24 19:49 ` Re: Speed up fixes Dave Cramer <pg@fastcrypt.com>
@ 2005-10-24 20:31 ` Oliver Jowett <oliver@opencloud.com>
2005-10-24 20:48 ` Re: Speed up fixes Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Jowett @ 2005-10-24 20:31 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: Sergei Rogovskiy <sergey@brightech.com>; pgsql-jdbc
Dave Cramer wrote:
> I understand everything except the removal of replaceProcessingEnabled ?
His diff was reversed by the looks of it, so that's actually new code.
It looks like he is adding a new connection property
"replaceProcessingEnabled" which lets you disable escape processing for
all statements. I'm not convinced we want this, as when enabled we
wouldn't follow the JDBC spec.
Sergei, can you send through whatever profiling results that show that
replace processing is a hotspot? Maybe we can speed up the no-escapes
case, rather than disabling them altogether which seems like a bit of a
blunt instrument..
-O
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Speed up fixes
2005-10-21 15:57 Speed up fixes Sergei Rogovskiy <sergey@brightech.com>
2005-10-24 19:49 ` Re: Speed up fixes Dave Cramer <pg@fastcrypt.com>
2005-10-24 20:31 ` Re: Speed up fixes Oliver Jowett <oliver@opencloud.com>
@ 2005-10-24 20:48 ` Dave Cramer <pg@fastcrypt.com>
0 siblings, 0 replies; 5+ messages in thread
From: Dave Cramer @ 2005-10-24 20:48 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: Sergei Rogovskiy <sergey@brightech.com>; pgsql-jdbc
I'm applying the others plus Ken Gries' patches as well. I'm not
applying the escape processing one yet.
Dave
On 24-Oct-05, at 4:31 PM, Oliver Jowett wrote:
> Dave Cramer wrote:
>
>
>> I understand everything except the removal of
>> replaceProcessingEnabled ?
>>
>
> His diff was reversed by the looks of it, so that's actually new code.
>
> It looks like he is adding a new connection property
> "replaceProcessingEnabled" which lets you disable escape processing
> for all statements. I'm not convinced we want this, as when enabled
> we wouldn't follow the JDBC spec.
>
> Sergei, can you send through whatever profiling results that show
> that replace processing is a hotspot? Maybe we can speed up the no-
> escapes case, rather than disabling them altogether which seems
> like a bit of a blunt instrument..
>
> -O
>
>
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2005-10-24 20:48 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-21 15:57 Speed up fixes Sergei Rogovskiy <sergey@brightech.com>
2005-10-24 18:20 ` Dave Cramer <pg@fastcrypt.com>
2005-10-24 19:49 ` Dave Cramer <pg@fastcrypt.com>
2005-10-24 20:31 ` Oliver Jowett <oliver@opencloud.com>
2005-10-24 20:48 ` Dave Cramer <pg@fastcrypt.com>
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