[jboss-user] [EJB 3.0] - Re: Slow performance of queries and POJO mapping
markvl2
do-not-reply at jboss.com
Sat Nov 25 00:11:46 EST 2006
Setting hibernate logging to WARN does help but there is still a signficant performance difference.
Here are the elapsed times with 20 consecutive selects each returning 5000 different rows (averaged over 3 runs excluding the 1st run). Hibernate logging set to WARN.
createQuery(hsql): 11088ms
createNativeQuery(sql): 5573ms
createNativeQuery(sql,class): 7417ms
JDBC: 5052ms
So createQuery is still more than twice as slow as direct JDBC, even with Hibernate logging disabled.
createNativeQuery(sql) is close to the JDBC time, but this excludes the time to generate the POJOs from the list of Objects returned.
Interestingly, createNativeQuery(sql,class) is considerable faster than createQuery even though the underlying query is essentially the same.
So perhaps the best approach is to go with createNativeQuery(sql,class) and then tune as required by rewriting as JDBC calls.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988510#3988510
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988510
More information about the jboss-user
mailing list