-->
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.  [ 4 posts ] 
Author Message
 Post subject: Query Cache performance -- any progress?
PostPosted: Mon Mar 22, 2004 12:53 pm 
Newbie

Joined: Wed Feb 25, 2004 9:27 pm
Posts: 7
In Hibernate 2.1.2 QueryKey.hashCode() there is a comment about the method being "very inefficient".

I want to cache a few hundred queries that vary mostly by value. But because QueryKey.hashCode() only computes hash on the query string and not the values, I'm finding the performance to be much worse than going straight to the database.

My query use case is just complicated enough that I really don't want to hard code a bunch of hash maps or arrays for my data.

As a workaround I downloaded the lastest CVS version of QueryKey.java and TypedValue.java. These versions have a new toString() method. I combine the hash of QueryString.toString() with the original hash code to get a decent key distribution. This is still slow and CPU intensive, but preformance is now very much faster overall than calling my heavily loaded database.

My question is, what progress is being made on QueryKey for efficient, well distributed keys? Will the next release of Hibernate have a new, improved QueryKey.hashCode()?

I would contribute genuine solution myself, but I currently lack the necessary in-depth, comprehensive knowledge of Hibernate source code.

Thanks.

--Jeff


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 22, 2004 10:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
OK, I'll fix it now .... was just laziness on my part.

Actually, if you think about it, its usually not very efficient to cache the same query for many different parameter combinations.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 23, 2004 12:38 pm 
Newbie

Joined: Wed Feb 25, 2004 9:27 pm
Posts: 7
Gavin, thanks for looking into this.

I know the use of the query cache for same query/different params is not optimal.

For my use case, the exact query strings and param count is not known at compile time, only during run time, and even then it can change periodically over time.

The query cache, taken together with all of its configuration and managability aspects, is a very handy tool for dealing with these dynamic situations.


jeff


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 30, 2004 12:33 am 
Beginner
Beginner

Joined: Sun Sep 14, 2003 10:54 am
Posts: 36
Quote:
OK, I'll fix it now ....

Has it been fixed? Was looking at the change log, could not tell for sure. Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.