简体   繁体   English

SQL Server 2005 聚集索引删除运行时间长,不存在非聚集索引

[英]SQL Server 2005 Clustered Index Drop running long with no non-clustered indexes present

I'm dropping a clustered index from a table in a SQL Server 2005 database and it's taking a very long time to run.我正在从 SQL Server 2005 数据库中的表中删除一个聚集索引,它需要很长时间才能运行。

I did some research and determined that dropping a clustered index can take a long time because it's updating pointers in non-clustered indexes to instead reference the RowID of the table itself, however in this particular scenario there are no non-clustered indexes present on the table.我做了一些研究并确定删除聚集索引可能需要很长时间,因为它正在更新非聚集索引中的指针以引用表本身的 RowID,但是在这种特定情况下,没有非聚集索引存在于桌子。

There are a lot of foreign keys in the database, so it's possible that one of them might be referencing the clustered index ID.数据库中有很多外键,因此其中一个可能引用了聚集索引 ID。

Is there any way to determine what objects are using clustered index references as opposed to RowID?有没有办法确定哪些对象使用聚集索引引用而不是 RowID?

If there's a clustered index, everything uses that instead of a RowID - the clustered index key IS the row identifier.如果有聚集索引,则一切都使用它而不是RowID - 聚集索引键行标识符。

So the answer is, anything that references that table.所以答案是,任何引用该表的东西。

An easy, visual way to see your foreign key constraints is to add the tables into a Diagram.查看外键约束的一种简单、直观的方法是将表添加到图表中。 Then you can see the relationships and check if any are pointing to the clustered index.然后您可以查看关系并检查是否有任何关系指向聚集索引。

However, what is the reason that you are dropping the clustered index, which is most likely the primary key?但是,您删除聚集索引(很可能是主键)的原因是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM