国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

sqlserver 分區(qū)知識

2019-11-08 18:36:41
字體:
供稿:網(wǎng)友
--分區(qū)屬性SELECT * FROM sys.partitions AS p  JOIN sys.tables AS t      ON  p.object_id = t.object_id  WHERE p.partition_id IS NOT NULL      AND t.name = 'custom_file_error_log';--查看分區(qū)方案段select $partition.[PGTABLE_FORANA_FUNC](day) as [PGTABLE_FORANA_FUNC],count(*) as recordCountfrom [dbo].pgtable_forana_log_testgroup by  $partition.[PGTABLE_FORANA_FUNC](day)--查看分區(qū)詳情select convert(varchar(50), ps.name) as partition_scheme,p.partition_number, convert(varchar(10), ds2.name) as filegroup, convert(varchar(19), isnull(v.value, ''), 120) as range_boundary, str(p.rows, 9) as rowsfrom sys.indexes i join sys.partition_schemes ps on i.data_space_id = ps.data_space_id join sys.destination_data_spaces ddson 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_numberand 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_idand v.boundary_id = p.partition_number - pf.boundary_value_on_right WHERE i.object_id = object_id('custom_file_error_log')and i.index_id in (0, 1) order by p.partition_number--1.移除歷史記錄(一周前的) [每天23:30執(zhí)行一次]declare @day intset @day=365                         --DateName(day,getdate())%30+10                             --((select datepart(weekday,getdate()))%7+1)alter table UpdateInfo_Hist10switch partition @dayto UpdateInfo_Histtemp--刪除分區(qū)數(shù)據(jù)declare @day intset @day=365   --DateName(day,getdate()-10)                         --DateName(day,getdate())%30+10                             --((select datepart(weekday,getdate()))%7+1)alter table custom_file_error_log -- 分區(qū)表switch partition @dayto custom_file_error_log_TMP    --臨時表
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 石城县| 桐柏县| 隆回县| 青河县| 延吉市| 大竹县| 兴安县| 莆田市| 修文县| 罗山县| 都昌县| 通化县| 房产| 松潘县| 通城县| 洛阳市| 哈尔滨市| 五大连池市| 黑河市| 阿克陶县| 常宁市| 金平| 抚松县| 松江区| 霍山县| 石门县| 大英县| 日喀则市| 公主岭市| 虎林市| 固镇县| 八宿县| 深圳市| 西峡县| 山东| 左权县| 大安市| 五台县| 杨浦区| 崇文区| 金昌市|