Hi All,
I hava a problem about speed of database enquiry.
Problem:
It's a B/S application. Now I hava a database enquiry.
The statement stmt.executeQuery(sSQL) used long time(about 30s). The
return result have about 500 rows. If I copy the SQL to database
utilities to run it, itruns very fast(about 1-2s), why?? In another
function it also use stmt.executeQuery(sSQL)(returns about 500 rows),
it runs fast, so I dont think the reason is network between client,
database, server.
Could any one tell me why?? And how to change this
situation??
Thx for you suggestion!
Roedy Green - 06 Nov 2007 09:04 GMT
> It's a B/S application
In Canadian that would be "bull sh.t" application, meaning a pointless
exercise. I doubt that is what you intended. What does BS stand for
in your part of the world?

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
xhy_China - 06 Nov 2007 21:45 GMT
On Nov 6, 5:04 pm, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> > It's a B/S application
>
> In Canadian that would be "bull sh.t" application, meaning a pointless
> exercise. I doubt that is what you intended. What does BS stand for
> in your part of the world?
B/S means Browser/Server in my part of the world
Roedy Green - 06 Nov 2007 09:05 GMT
>The statement stmt.executeQuery(sSQL) used long time(about 30s).
can you show the code you are using the process the results? perhaps
you are doing something highly inefficient?

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
GArlington - 06 Nov 2007 13:25 GMT
> Hi All,
>
[quoted text clipped - 11 lines]
> situation??
> Thx for you suggestion!
Check that your JDBC driver is optimising and reusing query cache, try
to use PreparedStatement(), optimise whatever is in sSQL, run
stmt.executeQuery(sSQL), time it alone (i.e. put some timing code
around it), if there is still a problem post the actual code in sSQL.