-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: High # of compilations for certain prepared queries (DB2)
PostPosted: Tue Oct 12, 2004 6:34 pm 
Regular
Regular

Joined: Tue Sep 09, 2003 9:37 pm
Posts: 56
Location: Ogden, Utah, USA
Hi,

The simple queries mentioned below are showing up in the DB2 catalog cache as being executed ~800 times, but the number of compilations is showing up as 4294967295.

Is there anything in the way that hibernate prepares queries that might cause them to be compiled instead of pulled from an already-compiled cache on the db2 server? In looking at the code myself I don't think there's anything out of the ordinary there, but I was told this could happen as a result of "explicitly preparing" the query.

Are there any settings or changes I could make that could affect when a prepared statement requires a recompile?

Thanks for your help,
Jenica Humphreys
MountainView Software

---------------

[b]Hibernate version:[/b] 2.1

[b]Mapping documents:[/b]n/a

[b]Name and version of the database you are using:[/b]DB2 8.1 (with Websphere 5, Java 1.3)

[b]The generated SQL (show_sql=true):
select country0_.country_id as
country_id0_, country0_.country_cd as country_cd0_, c
ountry0_.description_txt as descript3_0_ from RM_COUNTRY country0_
where country0_.country_id=? with ur

select insured0_.name_txt as
x0_0_ from RM_INSURED insured0_ where (insured0_.insure d_id=? ) with
ur

select policy0_.policy_nbr as
x0_0_ from RM_Policy policy0_ where (policy0_.policy_i
d=? ) with ur


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 12, 2004 7:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Not sure if its pertinent, but I've seen the same sort of behaviour with SQL Server. Don't remeber all the details, but there it was a jdbc driver problem in the way they performed the binding of parameters (causing the query to be recompiled every time).

Does DB2 JDBC driver support prepared statement caching in your current configuration? Try it yourself directly through JDBC calls and see.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 12, 2004 10:28 pm 
Regular
Regular

Joined: Tue Sep 09, 2003 9:37 pm
Posts: 56
Location: Ogden, Utah, USA
Thanks Steve! This definitely gives me something to investigate. I'm not sure how to tell if the driver itself supports prepared statement cacheing. I think the WebSphere connection pool does some caching, and the db2 server itself does some cacheing.

Thanks for your help!
Jenica


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.