- juke,
salut
J'ai un table access contenant des logs apaches avec des sous partitions par année, J'aimerai sous partitionner l'années courante par mois, savez vous comment faire ?
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 26 27 28 29 30 31 32 33 34 35 36 | CREATE TABLE `access` ( `ip` INT UNSIGNED NOT NULL COMMENT "%a : Remote IP-address", `user` VARCHAR(80) NOT NULL COMMENT "%u : Remote user (from auth; may be bogus if return status (%s) is 401)", `date` DATETIME DEFAULT NULL COMMENT "%{%F %H:%M:%S}t : The time, in the form given by format, which should be in strftime(3) format. (potentially localized)", `protocol` CHAR(16) NOT NULL COMMENT "%H : The request protocol", `port` SMALLINT UNSIGNED NOT NULL COMMENT "%p : The canonical port of the server serving the request", `method` CHAR(14) NOT NULL COMMENT "%m : The request method", `file` VARCHAR(240) NOT NULL COMMENT "%U : The URL path requested, not including any query string.", `query` VARCHAR(7177) NOT NULL COMMENT "%q : The query string (prepended with a ? if a query string exists, otherwise an empty string)", `code` SMALLINT UNSIGNED NOT NULL COMMENT "%s : Status. For requests that got internally redirected, this is the status of the *original* request --- %>s for the last.", `sent` INT UNSIGNED NOT NULL COMMENT "%0 : Bytes sent, including headers, cannot be zero. You need to enable mod_logio to use this.", `seconds` BIGINT UNSIGNED NOT NULL COMMENT "%T : The time taken to serve the request, in seconds", `musec` BIGINT UNSIGNED NOT NULL COMMENT "%D : The time taken to serve the request, in microseconds", `referer` VARCHAR(491) DEFAULT NULL COMMENT "%{Referer}i : Header Referer value", `user_agent` VARCHAR(363) DEFAULT NULL COMMENT "%{User-Agent}i : Header User-agent value", INDEX(file), INDEX(code), INDEX(user), INDEX(seconds) ) PARTITION BY RANGE (YEAR(`date`)) ( PARTITION p2010 VALUES LESS THAN(2010), PARTITION p2011 VALUES LESS THAN(2011), PARTITION p2012 VALUES LESS THAN(2012), PARTITION p2013 VALUES LESS THAN(2013), PARTITION p2014 VALUES LESS THAN(2014), PARTITION p2015 VALUES LESS THAN(2015), PARTITION p2016 VALUES LESS THAN(2016), PARTITION pmax VALUES LESS THAN MAXVALUE ) ; |
+0
-0