开发者

Do I need to drop index on temp table?

开发者 https://www.devze.com 2023-01-01 00:24 出处:网络
Fairly simple question, but I don\'t see it anywhere 开发者_如何学Goelse on SO: Do indexes (indices?) on a temporary table get automatically deleted with the temporary table?

Fairly simple question, but I don't see it anywhere 开发者_如何学Goelse on SO:

Do indexes (indices?) on a temporary table get automatically deleted with the temporary table?

I'd imagine they do but I don't really know how to check to make sure.

Thanks,

Phil


Yes they get dropped along with the table. It is not possible for an index to exist independently of its table.

In terms of checking this for yourself you could do

SELECT OBJECT_NAME(OBJECT_ID), * FROM tempdb.sys.indexes

before and after running your DROP temp table.

0

精彩评论

暂无评论...
验证码 换一张
取 消