-->
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: Aggregate query : HQL vs SQL
PostPosted: Mon Jan 02, 2006 2:58 pm 
Newbie

Joined: Mon Jan 02, 2006 2:45 pm
Posts: 1
What is the performance implication of using HQL aggregate query vis-a-vis native SQL aggregate query ? For example if I am to get the average age of large population stored in database. Lets assume no of record is large.

My understanding is that HQL will fetch all people objects in client and compute the average age there. Whereas, in case of native SQL the computation will be done by sql AVG in the database and only the result will be returned to the client.

Wouldn't that have some performance impact ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 4:51 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
I think that anything the HQL parser doesn't recognize gets passed through to the SQL statement, so any function you want to use will work just fine. But it's very easy to turn on SQL logging and see what the HQL query turns into. Or if you use Eclipse and have the tools installed, you can see what the resulting SQL will be in the plugin.

_________________
nathan


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.