zoukankan      html  css  js  c++  java
  • mysql加速导入数据的简单设置

    mysql加速导入数据的简单设置

    # 修改前查询参数值
    show variables like 'foreign_key_checks'; 
    show variables like 'unique_checks';
    show variables like 'innodb_flush_log_at_trx_commit';
    show variables like 'sync_binlog';
    # 执行如下加速操作
    SET GLOBAL foreign_key_checks=0;
    SET GLOBAL unique_checks=0;
    SET GLOBAL innodb_flush_log_at_trx_commit=0;
    SET GLOBAL sync_binlog=0;
    
    # 执行具体的导入sql操作
    -- ...
    
    # 将参数修改回原值
    SET GLOBAL foreign_key_checks=1;
    SET GLOBAL unique_checks=1;
    SET GLOBAL innodb_flush_log_at_trx_commit=1;
    SET GLOBAL sync_binlog=1;

    # 如下是修改前后的比对qps和tps结果

    ---------+-------mysql-status-------+-----threads-----+-----slow-----+---bytes---+---------locks----------
    time | QPS TPS ins upd del| run con cre cac| sql tmp Dtmp| recv send| lockI lockW openT openF
    ---------+--------------------------+-----------------+--------------+-----------+------------------------
    22:45:40 | 0 796 796 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:41 | 0 735 735 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:42 | 0 722 722 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:43 | 0 767 767 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:44 | 0 845 845 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:45 | 0 893 893 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:46 | 0 858 858 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:47 | 0 960 960 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:48 | 0 984 984 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:49 | 0 971 971 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:50 | 0 940 940 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:51 | 0 866 866 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:52 | 0 1010 1010 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:53 | 0 914 914 0 0| 2 2 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:54 | 0 1025 1025 0 0| 2 2 1 1| 0 1 0| 0K 8K| 1 0 115 27
    22:45:55 | 0 1025 1025 0 0| 2 2 0 1| 0 1 0| 0K 8K| 1 0 115 27
    22:45:56 | 0 996 996 0 0| 2 2 0 1| 0 1 0| 0K 8K| 1 0 115 27
    22:45:57 | 2 1012 1012 0 0| 2 3 0 0| 0 1 0| 1K 8K| 1 0 115 27
    22:45:58 | 0 1124 1124 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:45:59 | 0 3636 3636 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    ---------+-------mysql-status-------+-----threads-----+-----slow-----+---bytes---+---------locks----------
    time | QPS TPS ins upd del| run con cre cac| sql tmp Dtmp| recv send| lockI lockW openT openF
    ---------+--------------------------+-----------------+--------------+-----------+------------------------
    22:46:00 | 0 3845 3845 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:01 | 0 3797 3797 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:02 | 0 3824 3824 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:03 | 0 3871 3871 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:04 | 0 3892 3892 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:05 | 0 3861 3861 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:06 | 0 3904 3904 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:07 | 0 3924 3924 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:08 | 0 3857 3857 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:09 | 0 3941 3941 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:10 | 0 3876 3876 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:11 | 0 3872 3872 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:12 | 0 3732 3732 0 0| 2 3 0 0| 0 1 0| 0K 7K| 1 0 115 27
    22:46:13 | 0 3659 3659 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:14 | 0 3763 3763 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:15 | 0 3746 3746 0 0| 2 3 0 0| 0 1 0| 0K 7K| 1 0 115 27
    22:46:16 | 0 3735 3735 0 0| 2 3 0 0| 0 1 0| 0K 7K| 1 0 115 27
    22:46:17 | 0 3751 3751 0 0| 2 3 0 0| 0 1 0| 0K 7K| 1 0 115 27
    22:46:18 | 0 3889 3889 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27
    22:46:19 | 0 3797 3797 0 0| 2 3 0 0| 0 1 0| 0K 8K| 1 0 115 27

  • 相关阅读:
    Github开源人脸识别项目face_recognition
    yolo源码解析(3):进行简单跳帧
    [转]详细解读TrueSkill 排名系统
    yolo源码解析(3):视频检测流程
    Java中replace和replaceall的区别
    对input输入框日期显示格式化
    Eclipse修改编码字体
    Eclipse修改控制台字体
    Eclipse文档注释导出doc
    数组的定义方式及初始化
  • 原文地址:https://www.cnblogs.com/bjx2020/p/9200572.html
Copyright © 2011-2022 走看看