• mysql优化初探


    这里用的是Mysql5.6.34win64版本

    设计数据库

    3F范式

    分库分表

    垂直分割

    水平分割取模算法

    修改配置


    下面是我的配置文件

    # For advice on how to change settings please see
    # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
    # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
    # *** default location during install, and will be replaced if you
    # *** upgrade to a newer version of MySQL.
    
    [mysqld]
    
    character_set_server = utf8
    
    # Remove leading # and set to the amount of RAM for the most important data
    # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
    # innodb_buffer_pool_size = 128M
    
    # Remove leading # to turn on a very important data integrity option: logging
    # changes to the binary log between backups.
    # log_bin
    log_bin=ON
    #错误日志
    #log_error=D:Program Filesmysql-5.6.34-winx64datalogserr.log
    #全查询日志 
    #log_output=FILE  
    
    #不启用的话慢日志查询会存在数据表中
    general_log=on
    general_log_file=query.log
    
    #慢查询日志
    slow_query_log=on   
    long_query_time=2
    #时间为2s
    slow_query_log_file=slowquery.log
    
    
    # These are commonly set, remove the # and set as required.
     basedir = D:Program Filesmysql-5.6.34-winx64
    # 日志存放目录
     datadir = D:Program Filesmysql-5.6.34-winx64data
     port = 3306
    # server_id = .....
    
    #二进制日志配置,第二、三行配置最后一个binlog-bin和binlog是不加后缀的文件名,不加后缀的话有妙用
    server_id=1
    #log_bin=D:Program Filesmysql-5.6.34-winx64datain_loginlog-bin
    #log_bin_index=D:Program Filesmysql-5.6.34-winx64datain_loginlog
    
    # Remove leading # to set options mainly useful for reporting servers.
    # The server defaults are faster for transactions and fast SELECTs.
    # Adjust sizes as needed, experiment to find the optimal values.
    # join_buffer_size = 128M
    # sort_buffer_size = 2M
    # read_rnd_buffer_size = 2M 
    
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
    
    

    索引

    当数据有重复的时候,如何降低幂等

    唯一索引

    定位慢查询

    日志配置在上面,将慢查询时间设置好(默认是10秒),重启mysql服务,之后如果超过设定时间,就会记录在log日志中。

  • 相关阅读:
    一道压强题
    考试习惯的审题+习题+电脑存放目录记录
    产品需求分类及KANO模型需求排序学习
    马斯洛需求层次理论及其新拓展学习笔记
    12-JQuery学习之bind绑定事件
    11-JQuery学习之ready预加载事件
    09-JQuery学习之删除元素
    10-JQuery学习之遍历元素
    08-JQuery学习之创建元素和添加元素
    06-JQuery学习之操作元素的样式
  • 原文地址:https://www.cnblogs.com/adroitwolf/p/14310059.html
Copyright © 2020-2023  润新知