-->
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.  [ 1 post ] 
Author Message
 Post subject: Augmenting query cache : long-lived, incremental query
PostPosted: Tue Nov 02, 2010 8:46 pm 
Newbie

Joined: Tue Nov 02, 2010 8:37 pm
Posts: 1
Hello!

I have this idea for extending how the Hibernate query cache works, but I don't know nearly enough to tell if this is feasible or not:

Suppose I have a fixed SQL query Q, and I want to track the result set of Q as other users update the database (via Hibernate ). But, I don't want to keep hitting the database to track the changes to Q. I realized that Hibernate has all of the information necessary to do this in memory.

So, I was thinking of the following setup:

1) initial run of Q against the database. Results will get put in the query cache. Mark this query somehow so that it never gets evicted from the query cache

2) also mark all entities returned by the query, (which are in the second level cache), so they never get evicted

3) handle Hibernate PostUpdate event, and run in-memory equivalent of Q on updated entities

4) if update modifies the results of Q, then update results in query cache. This would simply entail adding or removing entity ids, since that is all that's stored in the query cache.

Any feedback on the feasibility of this plan would be greatly appreciated.

If I can get this working, then I can significantly reduce load on my database.

Background: server farm with memcached second level cache.


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

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.