开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 9605|回复: 0

查询分区情况

[复制链接]

0

精华

597

贡献

110

赞扬

赞助者组

Rank: 14Rank: 14Rank: 14Rank: 14

帖子
18
软币
336
在线时间
19 小时
注册时间
2017-8-3
发表于 2020-10-16 09:13:42 | 显示全部楼层 |阅读模式
SELECT CONVERT(VARCHAR (50), ps.name) AS partition_scheme
, p.partition_number
, pf.name AS functions
, ds2.name AS filegroup
, CONVERT(VARCHAR (19), ISNULL(v.value, ''), 120) AS range_boundary
, STR(p.rows, 9) AS rows
FROM sys.indexes i
JOIN sys.partition_schemes ps ON i.data_space_id = ps.data_space_id
JOIN sys.destination_data_spaces dds ON ps.data_space_id = dds.partition_scheme_id
JOIN sys.data_spaces ds2 ON dds.data_space_id = ds2.data_space_id
JOIN sys.partitions p ON dds.destination_id = p.partition_number AND p.object_id = i.object_id AND p.index_id = i.index_id
JOIN sys.partition_functions pf ON ps.function_id = pf.function_id
LEFT JOIN sys.partition_range_values v ON pf.function_id = v.function_id AND v.boundary_id = p.partition_number - pf.boundary_value_on_right
WHERE i.object_id = OBJECT_ID('表名') AND i.index_id IN ( 0, 1 )ORDER BY p.partition_number ;


回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-12-22 09:20

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表