-->
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: Hibernate query takes ages, while in MSSQL it takes seconds
PostPosted: Wed Aug 27, 2008 9:17 am 
Newbie

Joined: Wed Aug 27, 2008 9:15 am
Posts: 1
Hi all.

I have a strange situation in our system which causes us a major problem. We have a query running on a big data table, joined with few fairly small tables. The query uses a date range. Our system is Java-Hibernate based, and when the system gets to the point of running the query it just gets stuck. When looking at the database from SQL Server profiler it looks like the database is busy, but not stuck (no deadlocks or timeouts). But here's the really strange part:

When copying the query- using copy/paste without changing a word, and using the EXACT time range of the hibernate query (the time range is past as a parameter)- the query takes MILLISECONDS! No problems at all.

We thought this has something to do with the date parameter sent to the query, so we altered the query in a way that it doesn't send a date as a parameter (but rather sends an integer). It WORKED! The query took 2 seconds to run.

The problem doesn't appear in Oracle databases, only SQL Server.

Anyone has any idea or insight on the matter? It smells like a Hibernate/MSSQL bug.... can anyone provide any details?

Thank you!
Nili


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.