[Partition] / [CLUSTERED INDEX] / [NON CLUSTERED INDEX] / [COLUMN STORE INDEX]
Bonjour à tous,
Je souhaiterai partitionné une table selon une fonction de partition sur des dates.
Cette table contient aujourd'hui 160 millions de lignes.
Voici la structure de ma table :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
CREATE TABLE [gtm_crb_bgc30mn] (
[conso_id] bigint IDENTITY(1, 1) NOT NULL,
[datepoint] datetime NOT NULL,
[dateday] date NOT NULL,
[yearno] smallint NOT NULL,
[monthno] tinyint NOT NULL,
[compteur_id] int NOT NULL,
[type_pt_id] tinyint NOT NULL,
[version] tinyint NOT NULL,
[puissance] float NOT NULL,
[dateversion] datetime NOT NULL,
[validation] varchar(1) NOT NULL,
[echeance] varchar(4) NOT NULL,
CONSTRAINT [pk_gtm_crb_bgc30mn]
PRIMARY KEY CLUSTERED ([conso_id] ASC) |
Question :
1. Est ce que je peux partitionner cette table sur le champs [datepoint] ?
2. Qu'en est il est de la PK [conso_id] ? Est ce que je dois la supprimer ou bien je peux la conserver ?
3. Est ce c'est bien comme cela qu'il faut créer la PK ?
4. Qu'en est il des index NON CLUSTERED ? Comment faire pour les aligner ?
5. Est ce que COLUMN STORE INDEX pourrait être plus performant ?
Code:
1 2 3 4 5 6 7
|
CREATE UNIQUE CLUSTERED INDEX [ix_gtm_crb_bgc30mn_datepoint] ON [gtm_crb_bgc30mn]
(
[conso_id] ASC,
[datepoint] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [ps_bgc_arch_datepoint]([datepoint]) |