Pacific-Design.com

    
Home Index

1. SQL

2. Partition

SQL / Partition /

USE engine2;
-- --------------------------------------------------- --
CREATE TABLE domain_partition (
  root2 varchar(64) NOT NULL DEFAULT '',
  alexa int(11) NOT NULL,
  dta date NOT NULL DEFAULT '2010-01-01',
  PRIMARY KEY (root2),
  KEY dta (dta)
) 
ENGINE=MyISAM DEFAULT CHARSET=utf8
PARTITION BY KEY(root2)
PARTITIONS 64
-- --------------------------------------------------- --


ALTER TABLE database.table

  PARTITION BY RANGE( partition_id) (
    PARTITION d0 VALUES LESS THAN (10000),
    PARTITION d1 VALUES LESS THAN (20000),
    PARTITION d2 VALUES LESS THAN (30000),
    PARTITION d3 VALUES LESS THAN (40000),
    PARTITION d4 VALUES LESS THAN (50000),
    PARTITION d5 VALUES LESS THAN (60000),
    PARTITION d6 VALUES LESS THAN (80000),
    PARTITION d7 VALUES LESS THAN MAXVALUE
);