[Pljava-dev] Problem with jdbc driver

Thomas Hallgren thhal at mailblocks.com
Fri Sep 17 14:32:08 UTC 2004


Daniel,

>I have a question, how much better is the performance of the functions
>if I use the GCJ???
>  
>
That depends on what you're doing. It can range from worse to a lot 
better. If you application creates lots of new connections, drops them, 
and recreates them, the performance increase can be dramatic. Especially 
if you declare the pljava shared object as a preloaded module. If a 
connection pool is utilized, and if your functions execute a great deal 
of code, you may actually get a performance decrease since the Sun JVM 
has a more efficient interpreter and hotspot optimizer. At present, only 
the pljava.jar is compiled into machine code when you use GCJ. Future 
GCJ based versions of PL/Java will be able to compile the jars loaded 
with install_jar() function as well.

If you're dependent on Java 1.5 you will have to wait a while before you 
can use GCJ. At present it's a somewhat incomplete 1.4 version.

Since you bring up performance I get somewhat worried. If you are 
experiencing bad performance, I'd really like to know when. Keep in mind 
though, that using the *client* JDBC driver (the one found at 
jdbc.postgresql.org) from within a PL/Java is something that I strongly 
discourage. You will get severe performance penalties since a new 
postgres process (and if a java function is called, a new JVM) is 
spawned each time you establish a new connection. Further more, the new 
connection is not attached to your session so it uses a completely 
separate transaction.  In contrast, The PL/Java internal JDBC driver 
should show really good performance and execute within the callers 
transaction.

Regards,

Thomas Hallgren






More information about the Pljava-dev mailing list