-->
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: doesn't use oracle date index
PostPosted: Thu Jan 27, 2005 12:03 pm 
Newbie

Joined: Mon Apr 05, 2004 3:46 pm
Posts: 1
I am posting this to share our solution to a problem ...no help is requested.

We had a problem in production where some of our queries weren't using the oracle date index (full table scan) and so were taking 12 sec and a hogging the disk I/O. Our DBAs asked me to fix it. After mocking up a lot of fake data, I found problem.

This is the kind of problem we don't see in development since we don't have 1 million records in a dev database.

The call to find() wasn't specifying the Hibernate type. The query ran fine, but indexes weren't used:

This doesn't use the index:
Code:
getHibernateTemplate().find("from TestResult testResult " +
"where testResult.dateCreated >= ? and testResult.dateCreated < ?",
new Object[]{startDate, endDate});


This uses the index:
Code:
getHibernateTemplate().find("from TestResult testResult " +
"where testResult.dateCreated >= ? and testResult.dateCreated < ?",
new Object[]{startDate, endDate},
new Type[]{Hibernate.DATE, Hibernate.DATE});


We are using:
Oracle 9i 9.2
Oracle thin driver 9.2.0.5
Hibernate version 2.1.2, 4 February 2003


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.