MySql Partitioning Örnek

ALTER TABLE `TABLOMUZ` DROP PRIMARY KEY, ADD PRIMARY KEY (`id`,`tarih`);

primary key i silip, primary keyi,tarih ile birleştiricez,

ALTER TABLE `TABLOMUZ`
      PARTITION BY RANGE(TO_DAYS(`tarih`))(      

      PARTITION `2011` VALUES LESS THAN (TO_DAYS('2012-01-01')),
      PARTITION `2012` VALUES LESS THAN (TO_DAYS('2013-01-01')),
      PARTITION `2013` VALUES LESS THAN (TO_DAYS('2014-01-01')),      

      PARTITION `201401` VALUES LESS THAN (TO_DAYS('2014-02-01')),
      PARTITION `201402` VALUES LESS THAN (TO_DAYS('2014-03-01')),
      PARTITION `201403` VALUES LESS THAN (TO_DAYS('2014-04-01')),
      PARTITION `201404` VALUES LESS THAN (TO_DAYS('2014-05-01')),
      PARTITION `201405` VALUES LESS THAN (TO_DAYS('2014-06-01')),
      PARTITION `201406` VALUES LESS THAN (TO_DAYS('2014-07-01')),
      PARTITION `201407` VALUES LESS THAN (TO_DAYS('2014-08-01')),
      PARTITION `201408` VALUES LESS THAN (TO_DAYS('2014-09-01')),
      PARTITION `201409` VALUES LESS THAN (TO_DAYS('2014-10-01')),
      PARTITION `201410` VALUES LESS THAN (TO_DAYS('2014-11-01')),
      PARTITION `201411` VALUES LESS THAN (TO_DAYS('2014-12-01')),
      PARTITION `201412` VALUES LESS THAN (TO_DAYS('2015-01-01')),       

      PARTITION `201501` VALUES LESS THAN (TO_DAYS('2015-02-01')),
      PARTITION `201502` VALUES LESS THAN (TO_DAYS('2015-03-01')),
      PARTITION `201503` VALUES LESS THAN (TO_DAYS('2015-04-01')),
      PARTITION `201504` VALUES LESS THAN (TO_DAYS('2015-05-01')),
      PARTITION `201505` VALUES LESS THAN (TO_DAYS('2015-06-01')),
      PARTITION `201506` VALUES LESS THAN (TO_DAYS('2015-07-01')),
      PARTITION `201507` VALUES LESS THAN (TO_DAYS('2015-08-01')),
      PARTITION `201508` VALUES LESS THAN (TO_DAYS('2015-09-01')),
      PARTITION `201509` VALUES LESS THAN (TO_DAYS('2015-10-01')),
      PARTITION `201510` VALUES LESS THAN (TO_DAYS('2015-11-01')),
      PARTITION `201511` VALUES LESS THAN (TO_DAYS('2015-12-01')),
      PARTITION `201512` VALUES LESS THAN (TO_DAYS('2016-01-01')),             

      PARTITION `2016` VALUES LESS THAN MAXVALUE 
);

http://pento.net/2011/04/28/partitioning-the-wordpress-comments-table/
http://www.pythian.com/blog/using-mysql-partitioning-instead-of-merge-tables/

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Şu HTML etiketlerini ve özelliklerini kullanabilirsiniz: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>