zoukankan      html  css  js  c++  java
  • mysql 表分区demo 按照日期 PARTITION

    CREATE TABLE test.bookorder (
    `id` bigint(20) unsigned NOT NULL,
    recdate date NOT NULL COMMENT '该记录入库时间'

    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单表'
    PARTITION BY RANGE (to_days(recdate)) (
    PARTITION p201810 VALUES LESS THAN (to_days('2018-11-01')),
    PARTITION p201811 VALUES LESS THAN (to_days('2018-12-01')),
    PARTITION p201812 VALUES LESS THAN (to_days('2019-01-01')),
    PARTITION p201901 VALUES LESS THAN (to_days('2019-02-01')),
    PARTITION p201902 VALUES LESS THAN (to_days('2019-03-01')),
    PARTITION p201903 VALUES LESS THAN (to_days('2019-04-01')),
    PARTITION p201904 VALUES LESS THAN (to_days('2019-05-01')),
    PARTITION p201905 VALUES LESS THAN (to_days('2019-06-01')),
    PARTITION p201906 VALUES LESS THAN (to_days('2019-07-01')),
    PARTITION p201907 VALUES LESS THAN (to_days('2019-08-01')),
    PARTITION p201908 VALUES LESS THAN (to_days('2019-09-01')),
    PARTITION p201909 VALUES LESS THAN (to_days('2019-10-01')),
    PARTITION p201910 VALUES LESS THAN (to_days('2019-11-01')),
    PARTITION p201911 VALUES LESS THAN (to_days('2019-12-01')),
    PARTITION p201912 VALUES LESS THAN (to_days('2020-01-01')),
    PARTITION p202001 VALUES LESS THAN (to_days('2020-02-01')),
    PARTITION p202002 VALUES LESS THAN (to_days('2020-03-01')),
    PARTITION p202003 VALUES LESS THAN (to_days('2020-04-01')),
    PARTITION p202004 VALUES LESS THAN (to_days('2020-05-01')),
    PARTITION p202005 VALUES LESS THAN (to_days('2020-06-01')),
    PARTITION p202006 VALUES LESS THAN (to_days('2020-07-01')),
    PARTITION p202007 VALUES LESS THAN (to_days('2020-08-01')),
    PARTITION p202008 VALUES LESS THAN (to_days('2020-09-01')),
    PARTITION p202009 VALUES LESS THAN (to_days('2020-10-01')),
    PARTITION p202010 VALUES LESS THAN (to_days('2020-11-01')),
    PARTITION p202011 VALUES LESS THAN (to_days('2020-12-01')),
    PARTITION p2021 VALUES LESS THAN (MAXVALUE) )
    ;

  • 相关阅读:
    webpack基础理解以及使用搭建
    前端优化系列之一:dns预获取 dns-prefetch 提升页面载入速度
    react 什么是虚拟DOM?深入了解虚拟DOM
    react PropTypes 与 DefaultProps
    react todolist代码优化
    react 拆分组件于组件
    react 部分语法补充
    react 的安装和案列Todolist
    浏览器的标准模式和怪异模式
    软件测试基础——慕课网
  • 原文地址:https://www.cnblogs.com/bianzhiwei/p/10073245.html
Copyright © 2011-2022 走看看