Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / December 2007

Tip: Looking for answers? Try searching our database.

SQL Server - Very long query time with OpenJPA and Hibernate

Thread view: 
rico.fabrini@gmail.com - 07 Nov 2007 16:19 GMT
Hello Everyone,

I am hoping somebody could point me in the right direction..

I have a table with close to a million entries. I've set up indexes
that are relevant to
the expected queries. Thanks to the indexes I can use Enterprise
Manager and
Query Analyzer to obtain results within say 3 seconds.

Those results are for when manually running queries generated by
OpenJPA and
also by Hibernate. However, when running the program itself, that uses
those frameworks,
the same query can take up to 30seconds before finally, and correctly,
returning even an
empty collection. That's on a production server, in instances when I
have even made sure
that the program is the only thing accessing the database server.

I don't observe such a long delay when executing the program on a
restored copy of the
database, and the table with ~million entries, on my own development
PC. The query time
is a matter of milliseconds.

I've copied all the data over to a PostgreSQL database, and here, on
both production server
and development workstation, the execution time is also a matter of
milliseconds.
I've used virtually identical META-INF\persistence.xml for the
respective frameworks on the
respective DBMS, and respective workstation/server.

I'm not clear where else to look for a culprit(s) here. I'm hoping
some people could help with
some advice. Thanks.

Rico.
Silvio Bierman - 03 Dec 2007 12:18 GMT
> Hello Everyone,
>
[quoted text clipped - 35 lines]
>
> Rico.

Hello Rico,

Unrealistically slow response times often stem from one of:

1) DNS resolution delays (could be both client and server side)
2) Encoding mismatch between query and indexes (Unicode versus plain,
note that the MS JDBC driver defaults to Unicode) leading to table scans.

If I had a choice I would go with PG anyway...

Kind regards,

Silvio Bierman


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.