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.  [ 6 posts ] 
Author Message
 Post subject: slowness when delete recs
PostPosted: Tue Aug 18, 2009 11:08 pm 
Newbie

Joined: Tue Aug 18, 2009 10:26 pm
Posts: 4
Hi

My Next question is , when i try to delete records in my oracle database ( via hibernate ) , it takes long time to delete . as i monitored , for a single record it takes 2 min of time.

to delete , i have 20 000 records in my database.

please help me to solve my basic issues .

Many Thanks
Luke


Top
 Profile  
 
 Post subject: Re: slowness when delete recs
PostPosted: Wed Aug 19, 2009 10:05 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Are there lots of related tables? How long does it take with a query?

Can you give us an example?

Batch processes aren't always the right fit for Hibernate. I'd suggest using native DB tools for large 20,000 record deletes or updates. That's what they're there for. But deleting a single record shouldn't take 2 minutes, and if it is, it's not Hibernate's fault! Something is wrong with that design.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: slowness when delete recs
PostPosted: Mon Aug 24, 2009 10:51 pm 
Newbie

Joined: Tue Aug 18, 2009 10:26 pm
Posts: 4
Thanks a lot Cameron McKenzie for your prompt reply . actually I'm new to hibernate and this server is in production now.Yes there is more than 20 000 records to delete and we have scheduled in the quartz_reminder.xml to delete those records periodically.

time period - 9 AM to 5 PM , within this time frame we have observed , it has been deleted only 350 records.as per your suggestion , it can be a designing issue.

Now it seems good practice to write an external application via JDBC to delete those records. But problem is we can not find out the sql query which is supposed to delete records.

Could you please help me to find out that delete query in the hibernate ?

When I'm doing Google for finding an answer , i found following help from one of a support forum . " In order to see SQL query we can just configure hibernate.show_sql=true in hibernate.cf.xml file. Then can see the queries in the console window during application execution."

My Current situation is hibernate.show_sql=false

How can we get the console window and how can we use it for capture the SQL delete query ?

Many Thanks
Luke


Top
 Profile  
 
 Post subject: Re: slowness when delete recs
PostPosted: Mon Aug 24, 2009 11:37 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Quote:
hibernate.show_sql=false


I'm guessing you can't change that on the production machine, right?

Can you even do that on a test machine, or in a sandbox somewhere and see what is being generated?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: slowness when delete recs
PostPosted: Mon Aug 24, 2009 11:47 pm 
Newbie

Joined: Tue Aug 18, 2009 10:26 pm
Posts: 4
yea , once we changed the parameter in to false , we have to restart the server to get activate the settings.so then its difficult to play around with the live server. you are correct we need to setup a test server.

if we could do this changes in live server and restart it at after mid night , then i think we can have expected results , isn't it ?( since we have server maintenance policies , we have to do at off peak / less traffic hours )

How do we get the sql in to log file ? how do we enable console window to check those sql queries ?

Thank you
Luke


Top
 Profile  
 
 Post subject: Re: slowness when delete recs
PostPosted: Tue Aug 25, 2009 8:12 am 
Newbie

Joined: Sat May 26, 2007 8:18 am
Posts: 9
收藏了 ^_^ 经典 实在太有才了








------------------------------------------------------------
为什么是中域互联选择了我,而不是啊红选择了我,为什么???


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.