how to find out defragment index pages in sql server 2008 using script?

走远了吗. 提交于 2019-12-12 06:23:56

问题


Hi i am using SQL SERVER 2008 R2 and i wanted to know how to get the defragment index pages in size for particular object, index in sql server 2008 r2 using script. can some one please help me to get this. thanks! in adavanced.


回答1:


Use this query:

SELECT object_id, index_id, avg_fragmentation_in_percent, page_count
FROM sys.dm_db_index_physical_stats(DB_ID('AdventureWorks'),  OBJECT_ID('HumanResources.Employee'), NULL, NULL, NULL)


来源:https://stackoverflow.com/questions/11774870/how-to-find-out-defragment-index-pages-in-sql-server-2008-using-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!