• mysql5.5 数据表根据日期分区实例


    将产生的数据根据日期分区,一天一个分区,创建分区实例如下:

    /*==============================================================*/
    /* Table: histdata                                              */
    /*==============================================================*/
    create table histdata
    (
       id                   int not null,
       sid                  char(36) not null,
       sname                char(20),
       date                 datetime not null,
       vtype                int,
       value                binary(16),
       aid                  char(36),
       aname                char(20),
       did                  char(36),
       dname                char(20),
       primary key (id,date)
    )
    
    PARTITION BY RANGE COLUMNS (date)   (
    PARTITION p1 VALUES LESS THAN ('2000-01-02'),
    PARTITION p2 VALUES LESS THAN ('2000-01-03'),
    PARTITION p3 VALUES LESS THAN ('2000-01-04'),
    PARTITION p4 VALUES LESS THAN ('2000-01-05'),
    PARTITION p5 VALUES LESS THAN ('2000-01-06'),
    PARTITION p6 VALUES LESS THAN ('2000-01-07'),
    PARTITION p7 VALUES LESS THAN ('2000-01-08'),
    PARTITION p8 VALUES LESS THAN ('2000-01-09'),
    PARTITION p9 VALUES LESS THAN ('2000-01-10'),
    PARTITION p10 VALUES LESS THAN ('2000-01-11'),
    PARTITION p11 VALUES LESS THAN ('2000-01-12'),
    PARTITION p12 VALUES LESS THAN ('2000-01-13'),
    PARTITION p13 VALUES LESS THAN ('2000-01-14'),
    PARTITION p14 VALUES LESS THAN ('2000-01-15'),
    PARTITION p15 VALUES LESS THAN ('2000-01-16'),
    PARTITION p16 VALUES LESS THAN ('2000-01-17'),
    PARTITION p17 VALUES LESS THAN ('2000-01-18'),
    PARTITION p18 VALUES LESS THAN ('2000-01-19'),
    PARTITION p19 VALUES LESS THAN ('2000-01-20'),
    PARTITION p20 VALUES LESS THAN ('2000-01-21'),
    PARTITION p21 VALUES LESS THAN ('2000-01-22'),
    PARTITION p22 VALUES LESS THAN ('2000-01-23'),
    PARTITION p23 VALUES LESS THAN ('2000-01-24'),
    PARTITION p24 VALUES LESS THAN ('2000-01-25'),
    PARTITION p25 VALUES LESS THAN ('2000-01-26'),
    PARTITION p26 VALUES LESS THAN ('2000-01-27'),
    PARTITION p27 VALUES LESS THAN ('2000-01-28'),
    PARTITION p28 VALUES LESS THAN ('2000-01-29'),
    PARTITION p29 VALUES LESS THAN ('2000-01-30'),
    PARTITION p30 VALUES LESS THAN ('2000-01-31'),
    PARTITION p31 VALUES LESS THAN ('2000-02-01'),
    PARTITION p32 VALUES LESS THAN ('2000-02-02'),
    PARTITION p33 VALUES LESS THAN ('2000-02-03'),
    PARTITION p34 VALUES LESS THAN ('2000-02-04'),
    PARTITION p35 VALUES LESS THAN ('2000-02-05'),
    PARTITION p36 VALUES LESS THAN ('2000-02-06'),
    PARTITION p37 VALUES LESS THAN ('2000-02-07'),
    PARTITION p38 VALUES LESS THAN ('2000-02-08'),
    PARTITION p39 VALUES LESS THAN ('2000-02-09'),
    PARTITION p40 VALUES LESS THAN ('2000-02-10'),
    PARTITION p41 VALUES LESS THAN ('2000-02-11'),
    PARTITION p42 VALUES LESS THAN ('2000-02-12'),
    PARTITION p43 VALUES LESS THAN ('2000-02-13'),
    PARTITION p44 VALUES LESS THAN ('2000-02-14'),
    PARTITION p45 VALUES LESS THAN ('2000-02-15'),
    PARTITION p46 VALUES LESS THAN ('2000-02-16'),
    PARTITION p47 VALUES LESS THAN ('2000-02-17'),
    PARTITION p48 VALUES LESS THAN ('2000-02-18'),
    PARTITION p49 VALUES LESS THAN ('2000-02-19'),
    PARTITION p50 VALUES LESS THAN ('2000-02-20'),
    PARTITION p51 VALUES LESS THAN ('2000-02-21'),
    PARTITION p52 VALUES LESS THAN ('2000-02-22'),
    PARTITION p53 VALUES LESS THAN ('2000-02-23'),
    PARTITION p54 VALUES LESS THAN ('2000-02-24'),
    PARTITION p55 VALUES LESS THAN ('2000-02-25'),
    PARTITION p56 VALUES LESS THAN ('2000-02-26'),
    PARTITION p57 VALUES LESS THAN ('2000-02-27'),
    PARTITION p58 VALUES LESS THAN ('2000-02-28'),
    PARTITION p59 VALUES LESS THAN ('2000-02-29'),
    PARTITION p60 VALUES LESS THAN ('2000-03-01'),
    PARTITION p61 VALUES LESS THAN ('2000-03-02'),
    PARTITION p62 VALUES LESS THAN ('2000-03-03'),
    PARTITION p63 VALUES LESS THAN ('2000-03-04'),
    PARTITION p64 VALUES LESS THAN ('2000-03-05'),
    PARTITION p65 VALUES LESS THAN ('2000-03-06'),
    PARTITION p66 VALUES LESS THAN ('2000-03-07'),
    PARTITION p67 VALUES LESS THAN ('2000-03-08'),
    PARTITION p68 VALUES LESS THAN ('2000-03-09'),
    PARTITION p69 VALUES LESS THAN ('2000-03-10'),
    PARTITION p70 VALUES LESS THAN ('2000-03-11'),
    PARTITION p71 VALUES LESS THAN ('2000-03-12'),
    PARTITION p72 VALUES LESS THAN ('2000-03-13'),
    PARTITION p73 VALUES LESS THAN ('2000-03-14'),
    PARTITION p74 VALUES LESS THAN ('2000-03-15'),
    PARTITION p75 VALUES LESS THAN ('2000-03-16'),
    PARTITION p76 VALUES LESS THAN ('2000-03-17'),
    PARTITION p77 VALUES LESS THAN ('2000-03-18'),
    PARTITION p78 VALUES LESS THAN ('2000-03-19'),
    PARTITION p79 VALUES LESS THAN ('2000-03-20'),
    PARTITION p80 VALUES LESS THAN ('2000-03-21'),
    PARTITION p81 VALUES LESS THAN ('2000-03-22'),
    PARTITION p82 VALUES LESS THAN ('2000-03-23'),
    PARTITION p83 VALUES LESS THAN ('2000-03-24'),
    PARTITION p84 VALUES LESS THAN ('2000-03-25'),
    PARTITION p85 VALUES LESS THAN ('2000-03-26'),
    PARTITION p86 VALUES LESS THAN ('2000-03-27'),
    PARTITION p87 VALUES LESS THAN ('2000-03-28'),
    PARTITION p88 VALUES LESS THAN ('2000-03-29'),
    PARTITION p89 VALUES LESS THAN ('2000-03-30'),
    PARTITION p90 VALUES LESS THAN ('2000-03-31'),
    PARTITION p91 VALUES LESS THAN ('2000-04-01'),
    PARTITION p92 VALUES LESS THAN ('2000-04-02'),
    PARTITION p93 VALUES LESS THAN ('2000-04-03'),
    PARTITION p94 VALUES LESS THAN ('2000-04-04'),
    PARTITION p95 VALUES LESS THAN ('2000-04-05'),
    PARTITION p96 VALUES LESS THAN ('2000-04-06'),
    PARTITION p97 VALUES LESS THAN ('2000-04-07'),
    PARTITION p98 VALUES LESS THAN ('2000-04-08'),
    PARTITION p99 VALUES LESS THAN ('2000-04-09'),
    PARTITION p100 VALUES LESS THAN ('2000-04-10'),
    PARTITION p101 VALUES LESS THAN ('2000-04-11'),
    PARTITION p102 VALUES LESS THAN ('2000-04-12'),
    PARTITION p103 VALUES LESS THAN ('2000-04-13'),
    PARTITION p104 VALUES LESS THAN ('2000-04-14'),
    PARTITION p105 VALUES LESS THAN ('2000-04-15'),
    PARTITION p106 VALUES LESS THAN ('2000-04-16'),
    PARTITION p107 VALUES LESS THAN ('2000-04-17'),
    PARTITION p108 VALUES LESS THAN ('2000-04-18'),
    PARTITION p109 VALUES LESS THAN ('2000-04-19'),
    PARTITION p110 VALUES LESS THAN ('2000-04-20'),
    PARTITION p111 VALUES LESS THAN ('2000-04-21'),
    PARTITION p112 VALUES LESS THAN ('2000-04-22'),
    PARTITION p113 VALUES LESS THAN ('2000-04-23'),
    PARTITION p114 VALUES LESS THAN ('2000-04-24'),
    PARTITION p115 VALUES LESS THAN ('2000-04-25'),
    PARTITION p116 VALUES LESS THAN ('2000-04-26'),
    PARTITION p117 VALUES LESS THAN ('2000-04-27'),
    PARTITION p118 VALUES LESS THAN ('2000-04-28'),
    PARTITION p119 VALUES LESS THAN ('2000-04-29'),
    PARTITION p120 VALUES LESS THAN ('2000-04-30'),
    PARTITION p121 VALUES LESS THAN ('2000-05-01'),
    PARTITION p122 VALUES LESS THAN ('2000-05-02'),
    PARTITION p123 VALUES LESS THAN ('2000-05-03'),
    PARTITION p124 VALUES LESS THAN ('2000-05-04'),
    PARTITION p125 VALUES LESS THAN ('2000-05-05'),
    PARTITION p126 VALUES LESS THAN ('2000-05-06'),
    PARTITION p127 VALUES LESS THAN ('2000-05-07'),
    PARTITION p128 VALUES LESS THAN ('2000-05-08'),
    PARTITION p129 VALUES LESS THAN ('2000-05-09'),
    PARTITION p130 VALUES LESS THAN ('2000-05-10'),
    PARTITION p131 VALUES LESS THAN ('2000-05-11'),
    PARTITION p132 VALUES LESS THAN ('2000-05-12'),
    PARTITION p133 VALUES LESS THAN ('2000-05-13'),
    PARTITION p134 VALUES LESS THAN ('2000-05-14'),
    PARTITION p135 VALUES LESS THAN ('2000-05-15'),
    PARTITION p136 VALUES LESS THAN ('2000-05-16'),
    PARTITION p137 VALUES LESS THAN ('2000-05-17'),
    PARTITION p138 VALUES LESS THAN ('2000-05-18'),
    PARTITION p139 VALUES LESS THAN ('2000-05-19'),
    PARTITION p140 VALUES LESS THAN ('2000-05-20'),
    PARTITION p141 VALUES LESS THAN ('2000-05-21'),
    PARTITION p142 VALUES LESS THAN ('2000-05-22'),
    PARTITION p143 VALUES LESS THAN ('2000-05-23'),
    PARTITION p144 VALUES LESS THAN ('2000-05-24'),
    PARTITION p145 VALUES LESS THAN ('2000-05-25'),
    PARTITION p146 VALUES LESS THAN ('2000-05-26'),
    PARTITION p147 VALUES LESS THAN ('2000-05-27'),
    PARTITION p148 VALUES LESS THAN ('2000-05-28'),
    PARTITION p149 VALUES LESS THAN ('2000-05-29'),
    PARTITION p150 VALUES LESS THAN ('2000-05-30'),
    PARTITION p151 VALUES LESS THAN ('2000-05-31'),
    PARTITION p152 VALUES LESS THAN ('2000-06-01'),
    PARTITION p153 VALUES LESS THAN ('2000-06-02'),
    PARTITION p154 VALUES LESS THAN ('2000-06-03'),
    PARTITION p155 VALUES LESS THAN ('2000-06-04'),
    PARTITION p156 VALUES LESS THAN ('2000-06-05'),
    PARTITION p157 VALUES LESS THAN ('2000-06-06'),
    PARTITION p158 VALUES LESS THAN ('2000-06-07'),
    PARTITION p159 VALUES LESS THAN ('2000-06-08'),
    PARTITION p160 VALUES LESS THAN ('2000-06-09'),
    PARTITION p161 VALUES LESS THAN ('2000-06-10'),
    PARTITION p162 VALUES LESS THAN ('2000-06-11'),
    PARTITION p163 VALUES LESS THAN ('2000-06-12'),
    PARTITION p164 VALUES LESS THAN ('2000-06-13'),
    PARTITION p165 VALUES LESS THAN ('2000-06-14'),
    PARTITION p166 VALUES LESS THAN ('2000-06-15'),
    PARTITION p167 VALUES LESS THAN ('2000-06-16'),
    PARTITION p168 VALUES LESS THAN ('2000-06-17'),
    PARTITION p169 VALUES LESS THAN ('2000-06-18'),
    PARTITION p170 VALUES LESS THAN ('2000-06-19'),
    PARTITION p171 VALUES LESS THAN ('2000-06-20'),
    PARTITION p172 VALUES LESS THAN ('2000-06-21'),
    PARTITION p173 VALUES LESS THAN ('2000-06-22'),
    PARTITION p174 VALUES LESS THAN ('2000-06-23'),
    PARTITION p175 VALUES LESS THAN ('2000-06-24'),
    PARTITION p176 VALUES LESS THAN ('2000-06-25'),
    PARTITION p177 VALUES LESS THAN ('2000-06-26'),
    PARTITION p178 VALUES LESS THAN ('2000-06-27'),
    PARTITION p179 VALUES LESS THAN ('2000-06-28'),
    PARTITION p180 VALUES LESS THAN ('2000-06-29'),
    PARTITION p181 VALUES LESS THAN ('2000-06-30'),
    PARTITION p182 VALUES LESS THAN ('2000-07-01'),
    PARTITION p183 VALUES LESS THAN ('2000-07-02'),
    PARTITION p184 VALUES LESS THAN ('2000-07-03'),
    PARTITION p185 VALUES LESS THAN ('2000-07-04'),
    PARTITION p186 VALUES LESS THAN ('2000-07-05'),
    PARTITION p187 VALUES LESS THAN ('2000-07-06'),
    PARTITION p188 VALUES LESS THAN ('2000-07-07'),
    PARTITION p189 VALUES LESS THAN ('2000-07-08'),
    PARTITION p190 VALUES LESS THAN ('2000-07-09'),
    PARTITION p191 VALUES LESS THAN ('2000-07-10'),
    PARTITION p192 VALUES LESS THAN ('2000-07-11'),
    PARTITION p193 VALUES LESS THAN ('2000-07-12'),
    PARTITION p194 VALUES LESS THAN ('2000-07-13'),
    PARTITION p195 VALUES LESS THAN ('2000-07-14'),
    PARTITION p196 VALUES LESS THAN ('2000-07-15'),
    PARTITION p197 VALUES LESS THAN ('2000-07-16'),
    PARTITION p198 VALUES LESS THAN ('2000-07-17'),
    PARTITION p199 VALUES LESS THAN ('2000-07-18'),
    PARTITION p200 VALUES LESS THAN ('2000-07-19'),
    PARTITION p201 VALUES LESS THAN ('2000-07-20'),
    PARTITION p202 VALUES LESS THAN ('2000-07-21'),
    PARTITION p203 VALUES LESS THAN ('2000-07-22'),
    PARTITION p204 VALUES LESS THAN ('2000-07-23'),
    PARTITION p205 VALUES LESS THAN ('2000-07-24'),
    PARTITION p206 VALUES LESS THAN ('2000-07-25'),
    PARTITION p207 VALUES LESS THAN ('2000-07-26'),
    PARTITION p208 VALUES LESS THAN ('2000-07-27'),
    PARTITION p209 VALUES LESS THAN ('2000-07-28'),
    PARTITION p210 VALUES LESS THAN ('2000-07-29'),
    PARTITION p211 VALUES LESS THAN ('2000-07-30'),
    PARTITION p212 VALUES LESS THAN ('2000-07-31'),
    PARTITION p213 VALUES LESS THAN ('2000-08-01'),
    PARTITION p214 VALUES LESS THAN ('2000-08-02'),
    PARTITION p215 VALUES LESS THAN ('2000-08-03'),
    PARTITION p216 VALUES LESS THAN ('2000-08-04'),
    PARTITION p217 VALUES LESS THAN ('2000-08-05'),
    PARTITION p218 VALUES LESS THAN ('2000-08-06'),
    PARTITION p219 VALUES LESS THAN ('2000-08-07'),
    PARTITION p220 VALUES LESS THAN ('2000-08-08'),
    PARTITION p221 VALUES LESS THAN ('2000-08-09'),
    PARTITION p222 VALUES LESS THAN ('2000-08-10'),
    PARTITION p223 VALUES LESS THAN ('2000-08-11'),
    PARTITION p224 VALUES LESS THAN ('2000-08-12'),
    PARTITION p225 VALUES LESS THAN ('2000-08-13'),
    PARTITION p226 VALUES LESS THAN ('2000-08-14'),
    PARTITION p227 VALUES LESS THAN ('2000-08-15'),
    PARTITION p228 VALUES LESS THAN ('2000-08-16'),
    PARTITION p229 VALUES LESS THAN ('2000-08-17'),
    PARTITION p230 VALUES LESS THAN ('2000-08-18'),
    PARTITION p231 VALUES LESS THAN ('2000-08-19'),
    PARTITION p232 VALUES LESS THAN ('2000-08-20'),
    PARTITION p233 VALUES LESS THAN ('2000-08-21'),
    PARTITION p234 VALUES LESS THAN ('2000-08-22'),
    PARTITION p235 VALUES LESS THAN ('2000-08-23'),
    PARTITION p236 VALUES LESS THAN ('2000-08-24'),
    PARTITION p237 VALUES LESS THAN ('2000-08-25'),
    PARTITION p238 VALUES LESS THAN ('2000-08-26'),
    PARTITION p239 VALUES LESS THAN ('2000-08-27'),
    PARTITION p240 VALUES LESS THAN ('2000-08-28'),
    PARTITION p241 VALUES LESS THAN ('2000-08-29'),
    PARTITION p242 VALUES LESS THAN ('2000-08-30'),
    PARTITION p243 VALUES LESS THAN ('2000-08-31'),
    PARTITION p244 VALUES LESS THAN ('2000-09-01'),
    PARTITION p245 VALUES LESS THAN ('2000-09-02'),
    PARTITION p246 VALUES LESS THAN ('2000-09-03'),
    PARTITION p247 VALUES LESS THAN ('2000-09-04'),
    PARTITION p248 VALUES LESS THAN ('2000-09-05'),
    PARTITION p249 VALUES LESS THAN ('2000-09-06'),
    PARTITION p250 VALUES LESS THAN ('2000-09-07'),
    PARTITION p251 VALUES LESS THAN ('2000-09-08'),
    PARTITION p252 VALUES LESS THAN ('2000-09-09'),
    PARTITION p253 VALUES LESS THAN ('2000-09-10'),
    PARTITION p254 VALUES LESS THAN ('2000-09-11'),
    PARTITION p255 VALUES LESS THAN ('2000-09-12'),
    PARTITION p256 VALUES LESS THAN ('2000-09-13'),
    PARTITION p257 VALUES LESS THAN ('2000-09-14'),
    PARTITION p258 VALUES LESS THAN ('2000-09-15'),
    PARTITION p259 VALUES LESS THAN ('2000-09-16'),
    PARTITION p260 VALUES LESS THAN ('2000-09-17'),
    PARTITION p261 VALUES LESS THAN ('2000-09-18'),
    PARTITION p262 VALUES LESS THAN ('2000-09-19'),
    PARTITION p263 VALUES LESS THAN ('2000-09-20'),
    PARTITION p264 VALUES LESS THAN ('2000-09-21'),
    PARTITION p265 VALUES LESS THAN ('2000-09-22'),
    PARTITION p266 VALUES LESS THAN ('2000-09-23'),
    PARTITION p267 VALUES LESS THAN ('2000-09-24'),
    PARTITION p268 VALUES LESS THAN ('2000-09-25'),
    PARTITION p269 VALUES LESS THAN ('2000-09-26'),
    PARTITION p270 VALUES LESS THAN ('2000-09-27'),
    PARTITION p271 VALUES LESS THAN ('2000-09-28'),
    PARTITION p272 VALUES LESS THAN ('2000-09-29'),
    PARTITION p273 VALUES LESS THAN ('2000-09-30'),
    PARTITION p274 VALUES LESS THAN ('2000-10-01'),
    PARTITION p275 VALUES LESS THAN ('2000-10-02'),
    PARTITION p276 VALUES LESS THAN ('2000-10-03'),
    PARTITION p277 VALUES LESS THAN ('2000-10-04'),
    PARTITION p278 VALUES LESS THAN ('2000-10-05'),
    PARTITION p279 VALUES LESS THAN ('2000-10-06'),
    PARTITION p280 VALUES LESS THAN ('2000-10-07'),
    PARTITION p281 VALUES LESS THAN ('2000-10-08'),
    PARTITION p282 VALUES LESS THAN ('2000-10-09'),
    PARTITION p283 VALUES LESS THAN ('2000-10-10'),
    PARTITION p284 VALUES LESS THAN ('2000-10-11'),
    PARTITION p285 VALUES LESS THAN ('2000-10-12'),
    PARTITION p286 VALUES LESS THAN ('2000-10-13'),
    PARTITION p287 VALUES LESS THAN ('2000-10-14'),
    PARTITION p288 VALUES LESS THAN ('2000-10-15'),
    PARTITION p289 VALUES LESS THAN ('2000-10-16'),
    PARTITION p290 VALUES LESS THAN ('2000-10-17'),
    PARTITION p291 VALUES LESS THAN ('2000-10-18'),
    PARTITION p292 VALUES LESS THAN ('2000-10-19'),
    PARTITION p293 VALUES LESS THAN ('2000-10-20'),
    PARTITION p294 VALUES LESS THAN ('2000-10-21'),
    PARTITION p295 VALUES LESS THAN ('2000-10-22'),
    PARTITION p296 VALUES LESS THAN ('2000-10-23'),
    PARTITION p297 VALUES LESS THAN ('2000-10-24'),
    PARTITION p298 VALUES LESS THAN ('2000-10-25'),
    PARTITION p299 VALUES LESS THAN ('2000-10-26'),
    PARTITION p300 VALUES LESS THAN ('2000-10-27'),
    PARTITION p301 VALUES LESS THAN ('2000-10-28'),
    PARTITION p302 VALUES LESS THAN ('2000-10-29'),
    PARTITION p303 VALUES LESS THAN ('2000-10-30'),
    PARTITION p304 VALUES LESS THAN ('2000-10-31'),
    PARTITION p305 VALUES LESS THAN ('2000-11-01'),
    PARTITION p306 VALUES LESS THAN ('2000-11-02'),
    PARTITION p307 VALUES LESS THAN ('2000-11-03'),
    PARTITION p308 VALUES LESS THAN ('2000-11-04'),
    PARTITION p309 VALUES LESS THAN ('2000-11-05'),
    PARTITION p310 VALUES LESS THAN ('2000-11-06'),
    PARTITION p311 VALUES LESS THAN ('2000-11-07'),
    PARTITION p312 VALUES LESS THAN ('2000-11-08'),
    PARTITION p313 VALUES LESS THAN ('2000-11-09'),
    PARTITION p314 VALUES LESS THAN ('2000-11-10'),
    PARTITION p315 VALUES LESS THAN ('2000-11-11'),
    PARTITION p316 VALUES LESS THAN ('2000-11-12'),
    PARTITION p317 VALUES LESS THAN ('2000-11-13'),
    PARTITION p318 VALUES LESS THAN ('2000-11-14'),
    PARTITION p319 VALUES LESS THAN ('2000-11-15'),
    PARTITION p320 VALUES LESS THAN ('2000-11-16'),
    PARTITION p321 VALUES LESS THAN ('2000-11-17'),
    PARTITION p322 VALUES LESS THAN ('2000-11-18'),
    PARTITION p323 VALUES LESS THAN ('2000-11-19'),
    PARTITION p324 VALUES LESS THAN ('2000-11-20'),
    PARTITION p325 VALUES LESS THAN ('2000-11-21'),
    PARTITION p326 VALUES LESS THAN ('2000-11-22'),
    PARTITION p327 VALUES LESS THAN ('2000-11-23'),
    PARTITION p328 VALUES LESS THAN ('2000-11-24'),
    PARTITION p329 VALUES LESS THAN ('2000-11-25'),
    PARTITION p330 VALUES LESS THAN ('2000-11-26'),
    PARTITION p331 VALUES LESS THAN ('2000-11-27'),
    PARTITION p332 VALUES LESS THAN ('2000-11-28'),
    PARTITION p333 VALUES LESS THAN ('2000-11-29'),
    PARTITION p334 VALUES LESS THAN ('2000-11-30'),
    PARTITION p335 VALUES LESS THAN ('2000-12-01'),
    PARTITION p336 VALUES LESS THAN ('2000-12-02'),
    PARTITION p337 VALUES LESS THAN ('2000-12-03'),
    PARTITION p338 VALUES LESS THAN ('2000-12-04'),
    PARTITION p339 VALUES LESS THAN ('2000-12-05'),
    PARTITION p340 VALUES LESS THAN ('2000-12-06'),
    PARTITION p341 VALUES LESS THAN ('2000-12-07'),
    PARTITION p342 VALUES LESS THAN ('2000-12-08'),
    PARTITION p343 VALUES LESS THAN ('2000-12-09'),
    PARTITION p344 VALUES LESS THAN ('2000-12-10'),
    PARTITION p345 VALUES LESS THAN ('2000-12-11'),
    PARTITION p346 VALUES LESS THAN ('2000-12-12'),
    PARTITION p347 VALUES LESS THAN ('2000-12-13'),
    PARTITION p348 VALUES LESS THAN ('2000-12-14'),
    PARTITION p349 VALUES LESS THAN ('2000-12-15'),
    PARTITION p350 VALUES LESS THAN ('2000-12-16'),
    PARTITION p351 VALUES LESS THAN ('2000-12-17'),
    PARTITION p352 VALUES LESS THAN ('2000-12-18'),
    PARTITION p353 VALUES LESS THAN ('2000-12-19'),
    PARTITION p354 VALUES LESS THAN ('2000-12-20'),
    PARTITION p355 VALUES LESS THAN ('2000-12-21'),
    PARTITION p356 VALUES LESS THAN ('2000-12-22'),
    PARTITION p357 VALUES LESS THAN ('2000-12-23'),
    PARTITION p358 VALUES LESS THAN ('2000-12-24'),
    PARTITION p359 VALUES LESS THAN ('2000-12-25'),
    PARTITION p360 VALUES LESS THAN ('2000-12-26'),
    PARTITION p361 VALUES LESS THAN ('2000-12-27'),
    PARTITION p362 VALUES LESS THAN ('2000-12-28'),
    PARTITION p363 VALUES LESS THAN ('2000-12-29'),
    PARTITION p364 VALUES LESS THAN ('2000-12-30'),
    PARTITION p365 VALUES LESS THAN ('2000-12-31'),
    PARTITION p366 VALUES LESS THAN ('2001-01-01'),
    PARTITION p367 VALUES LESS THAN (MAXVALUE)
    );
    
    /*==============================================================*/
    /* Index: Index_sid_date                                        */
    /*==============================================================*/
    create index Index_sid_date on histdata
    (
       sid,
       date
    );


    检查分区是否成功,执行以下语句(可修改where语句,查看指定日期或时间段是否在预期分区内)

    explain partitions
    select count(*) from histdata where date='2000-12-01';

    结果如下

    显示date='2000-12-01'对应的数据记录在p336分区,分区正确。

  • 相关阅读:
    多态
    扩展方法
    git 新账户链接新仓库地址
    获取数据类型
    解构赋值
    var let const 无关键字定义变量
    http
    onmouseover、onmouseout、onmouseenter、onmouseleave
    setInterval、setTimeout、requestAnimationFrame
    vue的prop父子组件传值
  • 原文地址:https://www.cnblogs.com/liancs/p/3879263.html
Copyright © 2020-2023  润新知