16 Mart 2023 Perşembe

CREATE TABLE LIST partitioning

Giriş
Açıklaması şöyle.  Sütün hangi listeye girerse o bölümlemeye yazılır
LIST partitioning is similar to partitioning by RANGE, except that the partition is selected based on columns matching one of a set of discrete values.
Açıklaması şöyle. Yani sütunun unique olması gerekir
Remember that this partition requires the column to be a primary index or part of a compound primary index. 
Örnek
Şöyle yaparız
CREATE TABLE Table (val INT)
PARTITION BY LIST(val)(
  PARTITION myFirstPart VALUES IN (1,3,5),
  PARTITION MyPart VALUES IN (2,4,6),
  .........
);
Örnek
Şöyle yaparız
# create a compound primary index between the id and store id 
ALTER TABLE customers ADD UNIQUE (id, store_id);

ALTER TABLE customers
PARTITION BY LIST(store_id)(
  PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25),
  PARTITION p1 VALUES IN (26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50),
  PARTITION p2 VALUES IN (51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75),
  PARTITION p3 VALUES IN (76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101)
);

Hiç yorum yok:

Yorum Gönder

Soft Delete

Giriş Açıklaması  şöyle When using the soft delete mechanism on the database, you might run into a situation where a record with a unique co...