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: HQL Editor's HQL query runs much faster than our App. Why?
PostPosted: Tue Jan 08, 2008 5:36 pm 
Newbie

Joined: Tue Jan 08, 2008 5:07 pm
Posts: 1
Location: San Diego, CA
Hello,

Our HQL query to Postgres 8.1 was slow. 8.1's was known for slower sort performance. However, I tried to use Eclipse 3.3 with the latest Hibernate Tools 3.2.9 and the HQL Editor can run this query

select sample.barcode from Sample sample order by barcode

and get back more than 660K records in 8 or 9 seconds 1st time. If I rerun the query, it will be super fast (1 or 2 seconds) every time after. While our application doing standard (openSession, createQuery(HQL), setFirstResult(1), setMaxResult(100), Query.list, closeSession) will always run for 10 seconds or more. Even doing Query.setCacheable(true) in between createQuery and Query.setFirstResult does not change the speed.

My question is. What did HQL Editor do to speedup the query? I tried to find the source code for HQL editor in JBoss' site and found the ExecuteHQLAction that uses ConsoleConfiguration which uses HQLQueryPage. Finally HQLQueryPage actually does the standard openSession, createQuery, query, closeSession steps. It seems that there might be options/configuration that came in as local options or query parameters. Since I am not setup as a HQL Editor developer, I couldn't use the debugger to pause the editor to find out. Could some one please unveil the secret here?

Thank you!

Alvin

Hibernate version:3.2.1

Mapping documents:hibernate.cfg.xml

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:Postgres 8.1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 09, 2008 2:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
No, secrets. One of the goals of the HQL editor is to just like hibernate does if it was in your app.

I would use a profiler on your app to figure out where the time is spent in your app.

_________________
Max
Don't forget to rate


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.