Created
May 21, 2014 14:40
-
-
Save GC-Mark/5e8d4f78e51ec4953e45 to your computer and use it in GitHub Desktop.
Partition MySQL table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `table_name` ( | |
`employerID` int(5) DEFAULT NULL, | |
`pageID` varchar(50) DEFAULT NULL, | |
`userIP` varchar(15) DEFAULT NULL, | |
`clickdate` int(11) DEFAULT NULL, | |
`whitelist` int(1) DEFAULT NULL, | |
`dateIndex` date DEFAULT NULL, | |
KEY `employerID` (`employerID`), | |
KEY `pageID` (`pageID`), | |
KEY `userIP` (`userIP`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 | |
PARTITION BY RANGE ( YEAR(dateIndex)) | |
(PARTITION p0 VALUES LESS THAN (2008) ENGINE = MyISAM, | |
PARTITION p1 VALUES LESS THAN (2009) ENGINE = MyISAM, | |
PARTITION p2 VALUES LESS THAN (2010) ENGINE = MyISAM, | |
PARTITION p3 VALUES LESS THAN (2011) ENGINE = MyISAM, | |
PARTITION p4 VALUES LESS THAN (2012) ENGINE = MyISAM, | |
PARTITION p5 VALUES LESS THAN (2013) ENGINE = MyISAM, | |
PARTITION p6 VALUES LESS THAN (2014) ENGINE = MyISAM, | |
PARTITION p7 VALUES LESS THAN (2015) ENGINE = MyISAM); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment