zoukankan      html  css  js  c++  java
  • 【练习】表维护

    1.在world数据库中新建一个名为city_temp的表,该表示city表的副本,将city表的内容插入city_temp表中。

    mysql> create table city_temp like city;
    Query OK, 0 rows affected (0.10 sec)
    
    mysql> insert into city_temp select * from city;
    Query OK, 4080 rows affected (0.46 sec)
    Records: 4080  Duplicates: 0  Warnings: 0

    2.通过使用id列删除city_temp表数据中的多个行来创建‘洞’(删除或更新产生的行间隔)。

    mysql> delete from city_temp where id between 1001 and 2000;
    Query OK, 1000 rows affected (0.18 sec)
    mysql> show table status like 'city_temp'G
    *************************** 1. row ***************************
               Name: city_temp
             Engine: InnoDB
            Version: 10
         Row_format: Compact
               Rows: 3080
     Avg_row_length: 106
        Data_length: 327680
    Max_data_length: 0
       Index_length: 98304
          Data_free: 0
     Auto_increment: 4081
        Create_time: 2016-11-05 04:18:28
        Update_time: NULL
         Check_time: NULL
          Collation: latin1_swedish_ci
           Checksum: NULL
     Create_options: 
            Comment: 
    1 row in set (0.00 sec)

    3.通过对city_temp表运行analize table 来更新表的统计信息,确认已经分析。

    mysql> analyze table city_temp;
    +-----------------+---------+----------+----------+
    | Table           | Op      | Msg_type | Msg_text |
    +-----------------+---------+----------+----------+
    | world.city_temp | analyze | status   | OK       |
    +-----------------+---------+----------+----------+
    1 row in set (0.07 sec)
  • 相关阅读:
    线程池
    非XA式Spring分布式事务
    好的架构不是设计出来的,而是演进出来的
    缓存穿透
    【转】MySQL数据库主从同步管理
    setup 桌面化设置网卡
    gitlab web登入密码忘记以后可以用如下方式修改密码
    kvm与selinux
    linux下跳板机跟客户端之间无密码登陆
    LINUX下安装TeamViewer
  • 原文地址:https://www.cnblogs.com/tomatoes-/p/6031610.html
Copyright © 2011-2022 走看看