-->
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.  [ 2 posts ] 
Author Message
 Post subject: Understanding Hibernate caching
PostPosted: Wed Feb 17, 2010 11:29 am 
Newbie

Joined: Wed Jan 06, 2010 9:09 pm
Posts: 14
Hi All,

I'm using Hibernate with MySQL and Spring. I put some timing code around one of my queries (an HQL from xxx query) to see how long it was taking. I saw the first call take about 300ms, then subsequent calls where all around 20ms. I don't have 2nd level caching enabled, so what could be causing the subsequent queries to run so quickly?

Thanks,
Fred


Top
 Profile  
 
 Post subject: Re: Understanding Hibernate caching
PostPosted: Thu Feb 25, 2010 4:36 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Most databases have a internal cache too, where they store read pages.
When you issue the query for the second time, then probably
my-sql has the relevant pages already in cache and can deliver the query-result much faster
(only logical reads, no physical reads).


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