使用分区表提高并发能力和查询处理性能(需命中分区)
CREATE PARTITION FUNCTION RangePF1 ( INT )
AS RANGE LEFT FOR VALUES (10, 100, 1000) ;
SELECT $PARTITION.RangePF1 (1000) ;
CREATE PARTITION SCHEME RangePS1
AS PARTITION RangePF1
ALL TO ('PRIMARY') ;
CREATE TABLE dbo.PartitionTable (col1 int PRIMARY KEY, col2 char(100))
ON RangePS1 (col1) ;
INSERT into dbo.PartitionTable(col1, col2) VALUEs(10,N'another row'),(100,N'another row'),(500,N'another row'),(1000,N'another row')
SELECT
$PARTITION.RangePF1(col1) AS Partition,
COUNT(*) AS [COUNT]
FROM dbo.PartitionTable
GROUP BY $PARTITION.RangePF1(col1)
ORDER BY Partition ;
drop table dbo.PartitionTable
drop PARTITION SCHEME RangePS1
drop PARTITION FUNCTION RangePF1
select * from dbo.PartitionTable
标签:PartitionTable,dbo,创建,PARTITION,col1,RangePF1,分区表,another,mssql From: https://www.cnblogs.com/huft/p/18216046