Two patches

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: pgsql-patches(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Two patches
Date: 2003-02-28 19:14:00
Message-ID: b3o6mq$2c35$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi, everybody!

Attached are two patches for the JDBC sources -

comp_err_patch.txt fixes - a compilation error that I sent a message about earlier (but never got any reply for some reason):
(it fails the same way in both REL7_3_STABLE and HEAD sources)
> Buildfile: ./build.xml
>
> all:
>
> prepare:
> [mkdir] Created dir: /home/dima/postgres7.3/pgsql/src/interfaces/jdbc/build
> [mkdir] Created dir: /home/dima/postgres7.3/pgsql/src/interfaces/jdbc/jars
>
> check_versions:
>
> driver:
> [copy] Copying 1 file to /home/dima/postgres7.3/pgsql/src/interfaces/jdbc/org/postgresql
> [echo] Configured build for the JDBC3 edition driver
>
> compile:
> [javac] Compiling 52 source files to /home/dima/postgres7.3/pgsql/src/interfaces/jdbc/build
> [javac] /home/dima/postgres7.3/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java:560: incompatible types
> [javac] found : java.sql.PreparedStatement
> [javac] required: org.postgresql.jdbc2.PreparedStatement
> [javac] deleteStatement = ((java.sql.Connection) connection).prepareStatement(deleteSQL.toString());
> [javac] ^
> [javac] /home/dima/postgres7.3/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java:619: incompatible types
> [javac] found : java.sql.PreparedStatement
> [javac] required: org.postgresql.jdbc2.PreparedStatement
> [javac] insertStatement = ((java.sql.Connection) connection).prepareStatement(insertSQL.toString());
> [javac] ^
> [javac] /home/dima/postgres7.3/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java:955: incompatible types
> [javac] found : java.sql.PreparedStatement
> [javac] required: org.postgresql.jdbc2.PreparedStatement
> [javac] selectStatement = ((java.sql.Connection) connection).prepareStatement(selectSQL.toString());
> [javac] ^
> [javac] /home/dima/postgres7.3/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java:1038: incompatible types
> [javac] found : java.sql.PreparedStatement
> [javac] required: org.postgresql.jdbc2.PreparedStatement
> [javac] updateStatement = ((java.sql.Connection) connection).prepareStatement(updateSQL.toString());
> [javac] ^
> [javac] /home/dima/postgres7.3/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Statement.java:11: org.postgresql.jdbc2.Jdbc2Statement should be declared abstract; it does not define getMoreResults(int) in org.postgresql.jdbc2.Jdbc2Statement
> [javac] public class Jdbc2Statement extends org.postgresql.jdbc2.AbstractJdbc2Statement implements java.sql.Statement
>

The other one - timestamp_perf_patch.txt
Fixes some performance problem I ran into, that has to do with parsing Timestamps - I was running a query that returned lots
(like, a few thousand) rows, and it was taking much longer than I would expect. After some debugging and profiling, I was surprised
to find out, that *literally* most of the time was spent inside "new SimpleDateFormat()"...

So, I made those formats to only be created ones, and stored in a static field. That made that unfortunate query about 80% quicker.
I was also able to see some accross the board performance improvements (although, not that dramatic, because normally my queries would
only return a handful of rows, so the time wasted on creating those formats would be less noticable).
So, I am sending it your way in case you like what it does, and want to put it in...
Let me know if you see any problems with it.

Thanks!

Dima

Attachment Content-Type Size
timestamp_perf_patch.txt text/plain 5.9 KB
comp_err_patch.txt text/plain 5.9 KB

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-02-28 19:58:13 Re: postgres error reporting
Previous Message Dmitry Tkach 2003-02-28 19:01:34 Re: postgres error reporting