• mysql merge table


    SELECT COUNT(*) FROM `comment` 
    
    SHOW CREATE TABLE `comment`
    
    CREATE TABLE `comment1` (
      `id` INT(8) NOT NULL AUTO_INCREMENT,
      `blogUser` VARCHAR(20) NOT NULL,
      `replayUser` VARCHAR(20) NOT NULL,
      `articleId` INT(8) NOT NULL DEFAULT '0',
      `content` TEXT,
      `addTime` DATETIME NOT NULL,
      PRIMARY KEY (`id`),
      KEY `addTime` (`addTime`),
      KEY `replayUser` (`replayUser`)
    ) ENGINE=MYISAM AUTO_INCREMENT=1000004 DEFAULT CHARSET=utf8
    INSERT INTO comment1 SELECT  `id` ,
      `blogUser`,
      `replayUser`,
      `articleId` ,
      `content` ,
      `addTime`
    FROM `comment` LIMIT 0,500003
    
    CREATE TABLE `comment2` (
      `id` INT(8) NOT NULL AUTO_INCREMENT,
      `blogUser` VARCHAR(20) NOT NULL,
      `replayUser` VARCHAR(20) NOT NULL,
      `articleId` INT(8) NOT NULL DEFAULT '0',
      `content` TEXT,
      `addTime` DATETIME NOT NULL,
      PRIMARY KEY (`id`),
      KEY `addTime` (`addTime`),
      KEY `replayUser` (`replayUser`)
    ) ENGINE=MYISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
    
    INSERT INTO comment1 SELECT  `id` ,
      `blogUser`,
      `replayUser`,
      `articleId` ,
      `content` ,
      `addTime`
    FROM `comment` LIMIT 500003,60000000
    
    CREATE TABLE `allcomment` (
      `id` INT(8) NOT NULL AUTO_INCREMENT,
      `blogUser` VARCHAR(20) NOT NULL,
      `replayUser` VARCHAR(20) NOT NULL,
      `articleId` INT(8) NOT NULL DEFAULT '0',
      `content` TEXT,
      `addTime` DATETIME NOT NULL,
      PRIMARY KEY (`id`),
      KEY `addTime` (`addTime`),
      KEY `replayUser` (`replayUser`)
    ) ENGINE=MERGE UNION (comment1, comment2) INSERT_METHOD=LAST AUTO_INCREMENT=1 ; 
    
    SELECT COUNT(*) FROM `allcomment`

  • 相关阅读:
    C++面试考点
    C++面试考点
    C++11 引用叠加规则和模板参数类型推导规则
    C++11 引用叠加规则和模板参数类型推导规则
    C++11 auto和decltype推导规则
    C++11 auto和decltype推导规则
    RVO和NRVO
    RVO和NRVO
    Strange Bank(找零问题)
    eli和字符串 (牛客假期训练)
  • 原文地址:https://www.cnblogs.com/duyinqiang/p/5696372.html
Copyright © 2020-2023  润新知