SqlServer性能优化:Partition(创建分区)
2010-03-10 00:00:00 来源:WEB开发网1.在表没有索引的情况下:
BEGIN TRANSACTION
CREATE PARTITION FUNCTION [TestFunction](datetime) AS RANGE LEFT FOR VALUES (N'2010-01-01T00:00:00', N'2010-02-01T00:00:00',
N'2010-03-01T00:00:00', N'2010-04-01T00:00:00', N'2010-05-01T00:00:00', N'2010-06-01T00:00:00')
CREATE PARTITION SCHEME [TestScheme] AS PARTITION [TestFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY],
[PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY])
CREATE CLUSTERED INDEX [ClusteredIndex_on_TestScheme_634025264502439124] ON [dbo].[Account]
(
[birthday]
)WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [TestScheme]([birthday])
DROP INDEX [ClusteredIndex_on_TestScheme_634025264502439124] ON [dbo].[Account] WITH ( ONLINE = OFF )
COMMIT TRANSACTION
这里先创建Partition Function以及Partition Scheme,之后在分区列上创建聚集索引并按照分区方案分区,最后删除了这一索引。</>
2.在表有索引的情况下:
如果原先没有聚集索引:
CREATE CLUSTERED INDEX [ClusteredIndex_on_TestScheme_634025229911990663] ON [dbo].[Account]
(
[birthday]
)WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [TestScheme]([birthday])
DROP INDEX [ClusteredIndex_on_TestScheme_634025229911990663] ON [dbo].[Account] WITH ( ONLINE = OFF )
- ››SQLServer 游标简介与使用说明
- ››优化精髓之商业性网站常遇见的问题和误区
- ››优化增强您的Visual C++应用程序
- ››优化Windows 7错误报告弹出提示窗口
- ››优化您的 Apache Geronimo 发行版
- ››sqlserver游标概念与实例全面解说
- ››SqlServer性能优化——Slide Window
- ››优化迅游设置,台服魔兽全面加速
- ››性能更优越?教您了解64位Office 2010
- ››SqlServer性能优化:Partition(创建分区)
- ››SqlServer性能优化:Partition(管理分区)
- ››SQLServer2005中的uniqueidentifier数据类型与NEW...
赞助商链接