﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / SQL Server 2005 General Discussion  / Simple Delete Query is Taking Huge Time / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 21:50:13 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>[quote][b]Bhuvnesh (1/24/2013)[/b][hr][quote][b]Koen Verbeeck (1/24/2013)[/b][hr][url=http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/do-not-disable-foreign-keys]Do not disable foreign keys[/url][/quote] Any other reference ?[/quote]Maybe. I'm sure Google can help you out ;-)</description><pubDate>Thu, 24 Jan 2013 00:58:52 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>RE: Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>[quote][b]Koen Verbeeck (1/24/2013)[/b][hr][url=http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/do-not-disable-foreign-keys]Do not disable foreign keys[/url][/quote] Any other reference ?</description><pubDate>Thu, 24 Jan 2013 00:56:18 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>RE: Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>[quote][b]debanjan.ray (1/24/2013)[/b][hr]That table contains only 1lac rows. Table PK:Table_sr_key, table_eff_strt_dtTable FK(10 Fks like same structure): PRD_SR_KEY, EFF_STRT_DTREFERENCES Product (PRD_SR_KEY, EFF_STRT_DT)Table is refernced by more than 20 table.[/quote]This is primarily a English-speaking site, so 95% of the people here don't know what you mean with lac (or lakh). Also read the following article about keeping the integrity of your database when deleting rows in a table referenced by FKs:[url=http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/do-not-disable-foreign-keys]Do not disable foreign keys[/url]</description><pubDate>Thu, 24 Jan 2013 00:43:12 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>RE: Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>No.. On delete cascade option is not there with FK....</description><pubDate>Thu, 24 Jan 2013 00:39:45 GMT</pubDate><dc:creator>debanjan.ray</dc:creator></item><item><title>RE: Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>do FK are with "[b]on cascade delete[/b]" option ? </description><pubDate>Thu, 24 Jan 2013 00:35:06 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>RE: Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>still you havent posted what all i asked anyways i will suggest you to take [b]batch approach[/b] for "Deletion" . and i dont think "periodic statistics updation will help you much HERE "</description><pubDate>Thu, 24 Jan 2013 00:34:10 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>RE: Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>That table contains only 1lac rows. Table PK:Table_sr_key, table_eff_strt_dtTable FK(10 Fks like same structure): PRD_SR_KEY, EFF_STRT_DTREFERENCES Product (PRD_SR_KEY, EFF_STRT_DT)Table is refernced by more than 20 table.</description><pubDate>Thu, 24 Jan 2013 00:31:09 GMT</pubDate><dc:creator>debanjan.ray</dc:creator></item><item><title>RE: Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>Maybe you should create a job to automatically update your statistics, since they're clearly out of date.</description><pubDate>Thu, 24 Jan 2013 00:22:22 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>RE: Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>[quote][b]debanjan.ray (1/24/2013)[/b][hr]One of simple delete query is taking more than 10hrs to execute. There are more than 12 foreign keys dependent on that table. Query is like this, Delete from Some_Table where table_sr_key !=-99 and sector_id=@some_code [/quote] Two questions :How much data it contains ? and do FK are with "on cascade delete" option ? Also post table defintion  along with index definition</description><pubDate>Thu, 24 Jan 2013 00:13:25 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>Simple Delete Query is Taking Huge Time</title><link>http://www.sqlservercentral.com/Forums/Topic1410924-149-1.aspx</link><description>Hi All, One of simple delete query is taking more than 10hrs to execute. There are more than 12 foreign keys dependent on that table. Query is like this, Delete from Some_Table where table_sr_key !=-99 and sector_id=@some_code But if we execute the same query after updating the statistics of the table then the query get executed in few minutes. Please help me how me handle this issue so that those query will execute without any manual intervention. Thanks in advance, Debanjan</description><pubDate>Thu, 24 Jan 2013 00:03:59 GMT</pubDate><dc:creator>debanjan.ray</dc:creator></item></channel></rss>