› MySQL 5.5 Community Server
› MySQL 5.6 Community Server
› Percona Configuration Wizard
› XtraBackup 搭建主从复制
Great Sites on MySQL
› Percona
› MySQL Performance Blog
› Severalnines
推荐管理工具
› Sequel Pro
› phpMyAdmin
推荐书目
› MySQL Cookbook
MySQL 相关项目
› MariaDB
› Drizzle
参考文档
› http://mysql-python.sourceforge.net/MySQLdb.html
whitecats
V2EX  ›  MySQL

我有个 7000w 的 mysql 表,想把 3 个月以前的数据放到一个归档表中,有什么高效点的办法吗?

  •  
  •   whitecats · Apr 18, 2024 · 3006 views
    This topic created in 907 days ago, the information mentioned may be changed or developed.
    4 replies  •  2024-04-18 16:37:33 +08:00
    airqj
        1
    airqj  
       Apr 18, 2024
    新建一张一模一样的表存放最近三个月的数据
    然后旧表改名
    ElmerZhang
        2
    ElmerZhang  
       Apr 18, 2024
    如果三个月以前的数据量比较大,就建个新表把近三个月的拷出来,然后把两个表改名。
    否则的话只能建个归档表慢慢拷。拷之前别建索引,拷完再建索引。
    whitecats
        3
    whitecats  
    OP
       Apr 18, 2024
    @ElmerZhang 感谢
    cubecube
        4
    cubecube  
       Apr 18, 2024
    mysql 也支持分区表了,直接分区吧。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1024 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 22:13 · PVG 06:13 · LAX 15:13 · JFK 18:13
    ♥ Do have faith in what you're doing.