[关闭]
@dawn 2016-05-19T08:54:32.000000Z 字数 1990 阅读 683

Payment存量数据处理方案

payment


一.目前Payment的数据存储、备份方案


二.相关人员对历史数据的需求


三.对数据的要求


四.具体的操作方案

  1. #查看表的分区信息
  2. mysql> select partition_name part, partition_expression expr, partition_description descr, table_rows from information_schema.partitions where table_schema = schema() and table_name='user_credit';
  3. +---------+----------------------+--------+------------+
  4. | part | expr | descr | table_rows |
  5. +---------+----------------------+--------+------------+
  6. | p201604 | TO_DAYS(create_date) | 736450 | 302 |
  7. | p201605 | TO_DAYS(create_date) | 736481 | 63 |
  8. | p201606 | TO_DAYS(create_date) | 736511 | 50 |
  9. | p201607 | TO_DAYS(create_date) | 736542 | 65 |
  10. | p201608 | TO_DAYS(create_date) | 736573 | 69 |
  11. | p201609 | TO_DAYS(create_date) | 736603 | 61 |
  12. | p201610 | TO_DAYS(create_date) | 736634 | 77 |
  13. | p201611 | TO_DAYS(create_date) | 736664 | 65 |
  14. | p201612 | TO_DAYS(create_date) | 736695 | 62 |
  15. | p201701 | TO_DAYS(create_date) | 736726 | 73 |
  16. | p201702 | TO_DAYS(create_date) | 736754 | 55 |
  17. | p201703 | TO_DAYS(create_date) | 736785 | 57 |
  18. | p201704 | TO_DAYS(create_date) | 736815 | 0 |
  19. ...
  20. ...
  21. #找出时间最早的一个分区进行删除操作
  22. mysql> alter table user_credit drop partition p201604;
  23. Query OK, 0 rows affected (1.33 sec)
  24. Records: 0 Duplicates: 0 Warnings: 0
  25. #删除成功
  26. mysql> select partition_name part, partition_expression expr, partition_description descr, table_rows from information_schema.partitions where table_schema = schema() and table_name='user_credit';
  27. +---------+----------------------+--------+------------+
  28. | part | expr | descr | table_rows |
  29. +---------+----------------------+--------+------------+
  30. | p201605 | TO_DAYS(create_date) | 736481 | 63 |
  31. | p201606 | TO_DAYS(create_date) | 736511 | 50 |
  32. | p201607 | TO_DAYS(create_date) | 736542 | 65 |
  33. | p201608 | TO_DAYS(create_date) | 736573 | 69 |
  34. | p201609 | TO_DAYS(create_date) | 736603 | 61 |
  35. | p201610 | TO_DAYS(create_date) | 736634 | 77 |
  36. ...
  37. ...
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注