gpt4 book ai didi

sql-server - 是否可以从表的列中删除非聚集索引?

转载 作者:行者123 更新时间:2023-12-03 02:10:40 25 4
gpt4 key购买 nike

我只是想知道是否可以从表列中删除非聚集索引。我最近在列上创建了所需的非聚集索引。所以我只想删除这个索引,这样我就可以获得在表中添加索引之前和之后的执行计划。我想通过查询删除它。可能吗?

最佳答案

有一个DROP INDEX命令;

DROP INDEX table_name.index_name

应该可以。

也可以禁用索引。讨论优缺点here ,但这篇文章的有效点是:

The biggest difference between disabling and dropping an index is whether the metadata and statistics are persisted. If disabled, they are. If dropped, they are not. Make sure you carefully weigh your options before performing either action, and always have a way to recreate the index available.

因此,在这种情况下,您可能只想禁用索引,收集统计信息,然后通过以下方式重新启用索引:

禁用:

ALTER INDEX index_name ON schema.table_name DISABLE

启用:

ALTER INDEX index_name ON schema.table_name REBUILD

关于sql-server - 是否可以从表的列中删除非聚集索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23405620/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com