Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> java stored procedures fast, but slow when called as SQL function
Hello, I was doing some experiments in Oracle 9i (9.0.3 to be precise)
and Java stored procedures.
Formerly (oracle 8) these were very slow, it seemed no JIT was used.
Now I was pleased to note that Java code executed quite fast, clearly faster than PL/SQL. I made some compute intensive procedures both in PL/SQL and in Java to test this out.
Then I was dissapointed by the following: I made a very simple stored procedure (one which just returns the duplicated string/varchar as its single arument) and called it many times from an SQL statement:
select count(distinct duplicate(some_col)) from some_tab
some_tab has about 50000 records.
The select count(distinct some_col) directly returns almost immediately (0.3s).
The above statement when duplicate() is a PL/SQL function returns in 1.3s. When duplicate() is a Java function it takes over 6s!
Is this normal?!? It is like Java executes fast, faster than PL/SQL, but somehow the barrier between the SQL engine and Java engine is much larger than between SQL and PL/SQL.
Is there any option/configuration possible to make Java perform just like PL/SQL when used in this manner?
I was hoping to finally switch 100% to Java ISO PL/SQL, but this seems to be impossible still :(
-- Peter Mutsaers, Dübendorf, Switzerland.Received on Mon Apr 07 2003 - 12:25:33 CDT
![]() |
![]() |