知方可补不足~SQL为大数据引入分区表

时间:2021-03-14 13:02:22

回到目录

一些概念

分区表在oracle和sqlserver中都上存在的,当数据表的数据量过大时,上千万,上亿的数据,在进行数据查询时需要显得比较慢,性能很差,这时是时候引入分区表了,分区表顾名思义,就是把物理表用一些文件NDF进行分块存储,以缓减IO的压力,因为当你的SQL文件过大的,这其实对系统的IO影响是最大的,这种分区表我感觉类似于数据的分片(mongodb),它将有效的利用服务器的CPU多核资源,并行去处理你的请求,所以在大数据情况下,分区表是很好的一种选择!

我们通常也把电脑的磁盘分成若干的区,其中一种考虑也是为了性能,安全等

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkAAAAEJCAIAAADzRw9YAAAgAElEQVR4nO2dPZLrOLJGsSjVHtrqLaiMZ/SLG2O2X47KG2fcdp7ZijJnA3cBitrE+Hp3BxyDEgUiE4nkPyidL76oYJEACJAADpOkpPD/CCGE0N4UQghb1wEhhBAaLACGEEJolwJgCCGEdikAhhBCaJcCYAghhHYpAIYQQmiXAmAIIYR2KQCGEEJolwJgCCGEdqkQQrj+umKMMcb7MgDDGGO8SwMwjDHGu7QKsMvpLYS306W//vweDp+Xx5qvYwj9Nb2852NQCrn+ul5/nY+3jJfTW+jreP51Pb+Hgt7P9wocTt/3nbYrE3+fDiGz6ZHgeP4+HUI4fl1Ob+H4dWva8euR7PJ5CG+ni1LhEKVstx7Pv9R/01odv26HIt7RrcJ59RJbvrflcaC6w95vV/aYt8d23jpHtbpl7O9FrhTnothRPfb2sYG+fB7S4+a08xg++vxjKKV9LE2Tq+ctV7ccr1Tqph+QtJOf30V91u+r/vP+dkgO+234t53q+3RoFx6d8Hwc0Lrz8Vax9jT1a5zOnNd8f1ayy7ZfPvM9aFRn3oVDCCFu+eHzkhyI+4G+H8TuWKgAu59pdYIQhR8O0QlTxk83l6kzXdvXvzIj/+10KU0K4f18/T4f38Lx83QI4fh+DOFw/LrIQdgDWNwbHtP6/RB1W7PDvh3zh+PXpT1cvX19nw565x7oW9u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mZsTicBGeCGAcfyrcgPAEJJaB2ByNszNmJ6UOPYUgCULuQsI7h9u7gaAISS1zjOw+N/iJvkkZvPpo2ZPeQbmOVMc/xrcADCEpGp4C/GqXfszgTo9FGDFh15JGo5/DW4AGEJSNXwTB1PkapYRsLxD6EmDV3YDwBCS4st8Ma7fDQBDSAqAYVy/GwCGkBQAw7h+NwAMISkbYAihSgTAEEplAAwhVJUAGEI95QCGMa7WAAyhpgFgGO/QAAyhpgFgGO/QIYT/AsL/F8q0sHgcAAAAAElFTkSuQmCC" alt="" />

sql的分区表于若干的文件组组成,它们可以被理解成依照某个条件(分区函数)来进行划分的文件块,当你进行curd操作时,SQL会把它同时响应到对应的块上去,文件组里至少包含一个文件,当然可以是多个,它们也可以在不同的磁盘上。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgwAAAFjCAIAAADersRKAAAgAElEQVR4nO2dXWxUV7qmK9LcHHE1yt0Rd4er4WJupkcWOo44gqDQBDhCSt9MKueYWA5jcWiCJUATJzFNH3cwlscoOEKFExpEGwMHJ4DlFu52ZrAsjEa2RKYit2wkHwMdkBUjlYQjMldrLr5ie3v/1bd27Vp/+320FIVy/az6au333Wt966cgAI+mYk9TsWfviQlOoSfrrrKVIM4AGEVBdwWsAeKlBsQZAKOASXCBeKkBcQbAKGASXCBeakCcATAKmAQXiJcaEGcAjAImwQXipQbEGQCjgElwgXipAXEGwChgElwgXmpAnAEwCpgEF4iXGhBnAIwCJsEF4qUGxBkAo4BJcIF4qQFxBsAoYBJcIF5qQJwBMAqYBBeIlxoQZwCMAibBBeKlBsQZAKOASXCBeKkBcQbAKGASXCBeakCcATAKmAQXiJcaEGcAjAImwQXipQbEGQCjgElwgXipAXEGwChgElwgXmpAnAEwCpgEF4iXGhBnAIwCJsEF4qUGxBkAo4BJcIF4qQFxBsAoYBJcIF5qQJwBMAqYBBeIlxoQZwCMAibBBeKlBsQZAKOASXCBeKkBcQbAKGASXCBeakCcATAKmAQXiJcaEGcAjAImw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Wj7W/zVdZk3FnubWs9sOXdKuCDuP33zzw6E3PjjnVaz1xOXZuce6o5Uv0DYAyBBbTYJYevr8ZGnMuymj8sYH50gU1Aw40MW/tX2wufWsvxofD9yGBGgEbQOATLDbJDzuziycujC+70jJfyl6N5Jb2we3Hbq0o+PazuM3qchqhPfCHR3Xth26FL7sq5/V0vfxwO3x6bkXP/2sOySgCtoGAPXgiEl4rFRW784snB+Zau8eDtxFNqi0nrh86sL46GR5YWlZ97cHSaBtAJAC10wizOzc4+nvFs+PTJ0fmTp8+np793B79/CugwP8S725pY9e1d49/MXVu+dHpsan52bnHuOW0HbQNgCoifsmAQAAIDUwCQBUUpkf+Xzw3vPYv7+Yuen91f//EryYGfQ+wf//tlD5v7//15vz0X+qET07sOxH+f/qAVTL8aNF8gAAAABJRU5ErkJggg==" alt="" />

说干就干

下面来一步一步的实现一下分区表的建立逻辑

--建立两个文件组
ALTER DATABASE Test ADD FILEGROUP BEFORE2000
ALTER DATABASE Test ADD FILEGROUP AFTER2000
ALTER DATABASE Test ADD FILEGROUP AFTER2010 --创建文件
ALTER DATABASE Test ADD FILE
(Name=N'Before2000',filename='c:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\Before2000.ndf',size=5mb,maxsize=100Mb,filegrowth=5mb)
TO FILEGROUP Before2000
ALTER DATABASE Test ADD FILE
(Name=N'After2000',filename='c:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\After2000.ndf',size=5mb,maxsize=100Mb,filegrowth=5mb)
TO FILEGROUP After2000
ALTER DATABASE Test ADD FILE
(Name=N'After2010',filename='c:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\After2010.ndf',size=5mb,maxsize=100Mb,filegrowth=5mb)
TO FILEGROUP After2010

上面代码在磁盘上建立了两个文件组,用来存储2000年以前,2000-2010年,以2010年以后的数据,而ndf是分区表文件的类型,一个分区表文件组可以由多个ndf文件构成

--编写分区函数
CREATE PARTITION FUNCTION RangeTime (DATETIME) AS RANGE LEFT FOR VALUES ('2000-01-01','2010-01-01')
--编写分区方案, 分区方案也就是将分区函数与文件组进行一个关联
CREATE PARTITION SCHEME RangeSchema_CreateTime
AS PARTITION RangeTime
TO (BEFORE2000,AFTER2000,AFTER2010)

上面分区函数说明以哪里依据进行分区,而分区方案是将它与分区文件组进行接合,或者和数据表进行打通,以后我们用的时候,直接用分区函数(表名)即可。

--创建分区表,先建表,再设主键,否则会出错
CREATE TABLE Order
(
ID VARCHAR(50) ,
UserId VARCHAR(50) ,
CreateTime DATETIME
)
ON RangeSchema_CreateTime(CreateTime)

上面代码建立一张表,并进行分区的配置,注意,在建立表后,再建立主键,我们填充一些数据就可以测试了,下面介绍几个常用的命令 

返回2001-2-2日这条数据会被分配到哪个分区了

--测试某个对象放在哪个分区里
SELECT $PARTITION.RangeTime('2001-2-2')

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZ8AAAB8CAIAAAA5JypbAAAPnUlEQVR4nO1dPWsbSRjeWr/D7R0BVU4R/BN8kKvTLdh9dK2aqy+Gw2YxGBchVdyYYNQIhKsQbSGCsQshNSkMuhRR526umP2Y753Zb42ehwex3p2deeedmUfv7KzGwcPiayFJxwhSAgAA2CLouboF4zHUDQCAEui7ulEjLdVtcHDaBC1zpsl0ieXzTtnWbrl9tsqULRhfb+u0b5iTMUAT6Lu6OcVuFYeHLjchZ11BbD42w8nS4NL1Mpvq5MAWjFcaU842m5SunjE4yilxlUIBV/Rd3aiRTcduRAq7dMeGsUEkdXOqpKVhJeplKQdOpdgktkzDVl84kM9X8Q+RVKmiE2yydXICUC/6rm4txG7KQcKekXNWlmU2wDITXQJdYrMTlIXau1F31d6YwlKIRsV051394+p/cz42txQ2QUW/AfboQN2W9xfBeByMx8HFPXv+7mYcjMev7/+TjWxI3YiqI+o+XTtludFVOr1QBaU9yuqY/9SdKVFfs8HCXYX+dyrR0IKGM5ZFVO+WhTkA5dC2ut3d5KK2vL/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BDS0MaYmVg0lH/tgLoBgE8IKu5+aQYhpNH8a0fXzQEAQG1o/L/GyK+q9fmz6+YAAKA2NDikj46OHhZfv+8OgqDBfdgBAGgZibo19JCexkRdq5YtELsBgE9oXN26liwHIHYDAJ+A2C0HYjcA8AkGdbN6CbZ07Hb+Nn0l9+15mxJmAGI3APAJSnX7/NfvVHhqUDdl7PZl9CoVNeawayB2AwCf0FnsluHL6NWr0ZcWxKsQiN0AwCc0rm5Fz90QuwEA0Ag6jt2+jF4FPYncELsBgF/oMnbrlbR9R+wGAH6hs9itb9L2HbEbAPiFjmK387c9ehMkBWI3APAJ3cRu+ctuQRAEfYnhELsBgE/AbxVyIHYDAJ+A35nmQOwGAD4BsVsOxG4A4BMSdWtoI2/EbgAAdIXgYfG1uY28EbsBANAVGt95/KHrzcSdPrtuDgAAagPGMwAAfgLqBgCAn4C6AQDgJ6BuAAD4CagbAAB+4n/VjViO6YoHQAAAAABJRU5ErkJggg==" alt="" />

查看指定分区内的数据

--查看某个分区表里存放的数据
SELECT *
FROM shop
WHERE $PARTITION.RangeTime(CreateTime) = 1

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAARcAAAA+CAIAAACOZcjJAAAGsUlEQVR4nO2dPZLiPBCGdSEoYqLvClTBFcgJWNK5AQRTyyXI2PIZJqSmJvNh/AUWtqw/d1s/lnv6ra4to2nJEtZDS8a9iJ/X18/r6+Pj4z8WizVJQqWoSaaIjSftZ2ZRGgsxoS6NTlH7Mq6piJbT1OxGaSzEDBtUmKIiLtXsnWFTjSlajFEaCzFbFEXP02Z9qtoD0evwiW9q2MjhU2kca8/TRqwuT6OT2d6W11d1XkHejQl23wtd+2uKi75oWyxF/Ux9XNbOqeOeeddDN/Wfp43Y3YMoEqKrm52i6rzqz/66HrAggTp8PYjdPfEAl2sEKPJd1/GmAI2M2PO0WZ8u+/fczU3R47JWIuHU/iMoYvNemsVS5L7G7lj0uKzF5vzQGr/sh+uiftW3u0uf3WGtlHSdMfqmroXeK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zfF8UweZ6js5FkRadRqskFepqsbKpXIqiIPSdbF+UH6GGKSpV5VKUORYtQkxRmQqlKFH+bf5YtAhRGgslBVEUkGA7Io5FVjFFZSqIotQmOF2cbSE2nSI8tCDFbTxdP/OL0lgoKZSi6ExHR5TSzKM0FkpiipYkSmOhJKZoRMKtWD2EiykqU5Ep6n+LYeqPUQMpMp9Kxo7Qg4cKiYuWIikaeQKoS0Dt3rp0D/WgnDljvAdA+V0g388KRaCovm1FKEX62PAPrUKajSv3WOrxjPHB86Tv9DbNR21PfxDTOEUsZ34a1QVDdV4Nfn44JkX1basninnkaQpCiIcuyNnjCh6LtNwYLRc0eRI4ypkzIxwwpIxF1VHLDPPLTxHq2FU3mxArOkuCt5q0eqzsPlKBiXcoZ1t1zhjXfyYxLkWWt8yv8Fi0hBVdq5GM8fc6q3/nEiWBo5w519VCUQhCoxSp6+48scjlP4tQFKmlMs/OvcqfkATOGeOdIlMUiNAYRd2eVQoCUmAs0vyB71QiTaJI3lXwzok6chI4ypn3RQMGPnch/58jdF/UNE3iWKQW+gXpQETBKarNBO/hLqjlKlUSOMqZ79GpACg/3C2EEMnu0QGGBR6hGPteyOo8lybtiyz54RmSwFHOnDEeFHkmUwTXaFPwqFI8Rax59Hsp0lZlkNUaU8Sy6vdStERRGgslhVKULmN8lhEWLkpjoaQgigJSwkfEFFlFaSyUFEQRGxvbD/KjbUARElcWi9U0TBGLFS6miMUKFVPEYoXqf5CJr6wNfzJyAAAAAElFTkSuQmCC" alt="" />

查看某个分区里,记录的个数

--查看某个分区表的个数
SELECT $PARTITION.RangeTime(CreateTime) AS 分区编号 ,
COUNT(id) AS 记录数
FROM shop
GROUP BY $PARTITION.RangeTime(CreateTime)

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJoAAABQCAIAAABu7vuSAAAEPElEQVR4nO2dQW7jMAxFdaEEWWeVKxRIr5B9F5lsc4NmEbSXyK4Dn2GWg0F2OYxnkdp1Y4miKNKmVH4IRTrIyF98Ih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TjZ95HdO9llOOlS6Nxw0qXQOR1nf85H+7ITg7M/59N5dBuLXUGHfOen7usU+r8JjB/Bfx7UzhAXjMKxK7i55HJYLg4fosVWZ29JTdnZj4+XlVB29lLaW1Idzma/EL13tl3Z0gizPpxdsbXWL6+KxGmNmSGVg9PaptuacF4Hz5201MRkZ//cqTA128pw5g87FWKX4aRLoXPDSZdC5wk4rbnkQQqdY3FmdI9EpDAoSCl0jsVpo4gR5e02sf8HyVSQDGdVMpxV6T/ofdeHt5fCxQAAAABJRU5ErkJggg==" alt="" />

当数据量达到一定指数时,我们必须要进行调整,而选择哪种方法是靠技术决策人的,我们每个开发人员都应该把自己当成是技术的决策人,对自己的代码和自己的人生负责!

感谢您的阅读!

回到目录