Skip to content

Instantly share code, notes, and snippets.

@violetyk
Created April 27, 2017 09:27
Show Gist options
  • Save violetyk/b87b12f59bb4bbaf7710b6dd5cad1866 to your computer and use it in GitHub Desktop.
Save violetyk/b87b12f59bb4bbaf7710b6dd5cad1866 to your computer and use it in GitHub Desktop.
CREATE TABLE `samples` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`comment` varchar(255) NOT NULL,
`created` datetime NOT NULL,
PRIMARY KEY (`id`,`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(`created`) (
PARTITION samples_p20170427 VALUES LESS THAN('2017-04-28 00:00:00'),
PARTITION samples_p20170428 VALUES LESS THAN('2017-04-29 00:00:00')
);
-- ALTER TABLE `samples`
-- PARTITION BY RANGE COLUMNS(`created`) (
-- PARTITION samples_p20170429 VALUES LESS THAN('2017-04-30 00:00:00')
-- );
ALTER TABLE `samples` ADD PARTITION (
PARTITION samples_p20170430 VALUES LESS THAN('2017-05-01 00:00:00')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment