forked from vincent/notebook
25 lines
716 B
MySQL
25 lines
716 B
MySQL
|
-- cr<63>ation des espaces de stockage
|
|||
|
ALTER DATABASE ... ADD FILEGROUP ...
|
|||
|
ALTER DATABASE ... ADD FILE ( ... ) TO FILEGROUP ...
|
|||
|
|
|||
|
-- 1) cr<63>ation de la fonction de partitionnement
|
|||
|
CREATE PARTITION FUNCTION PF_DATE_FACTURE (DATETIME2(0))
|
|||
|
AS RANGE RIGHT
|
|||
|
FOR VALUES ('2018-01-01', '2019-01-01', '2020-01-01');
|
|||
|
|
|||
|
-- 2) cr<63>ation du sch<63>ma de r<>partition
|
|||
|
CREATE PARTITION SCHEME PS_DATE_FACTURE
|
|||
|
AS PARTITION PF_DATE_FACTURE
|
|||
|
TO (FG_OLD, FG_2018, FG_2019, FG_2020);
|
|||
|
|
|||
|
-- 3) cr<63>ation de l'objet sur la partition
|
|||
|
CREATE TABLE ( ... )
|
|||
|
ON PS_DATE_FACTURE (colonne_crit<EFBFBD>re)
|
|||
|
|
|||
|
CREATE INDEX ( ... ) --> la premi<EFBFBD>re colonne de la clef d'index doit <20>tre la colonne crit<69>re
|
|||
|
ON PS_DATE_FACTURE (colonne_crit<EFBFBD>re)
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|