zoukankan      html  css  js  c++  java
  • MySQL优化

    http://www.cnblogs.com/zhuyibo/p/3972075.html
    wait_timeout / interactive_timeout 连接超时
    skip-name-resolve连接解析
    max_connections 最大连接进程数,也就是允许同时连接的客户数量
    max_connect_errors 最大连接错误数
    max_allowed_packet 设置最大包,限制server接受的数据包大小,避免超长SQL的执行有问题
    thread_concurrency 允许通过的并发数 属重点优化参数
    back_log 设置MySQL能暂存的连接数量

    ========================================
    http://www.cnblogs.com/yydcdut/p/3905774.html
    对查询进行优化,要尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。
    应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而进行全表扫描
    应尽量避免在 where 子句中使用 != 或 <> 操作符,否则将引擎放弃使用索引而进行全表扫描。
    应尽量避免在 where 子句中使用 or 来连接条件,如果一个字段有索引,一个字段没有索引,将导致引擎放弃使用索引而进行全表扫描
    in 和 not in 也要慎用,否则会导致全表扫描

    对于连续的数值,能用 between 就不要用 in 了:
    select id from t where num between 1 and 3

    很多时候用 exists 代替 in 是一个好的选择:
    select num from a where num in(select num from b)
    用下面的语句替换:
    select num from a where exists(select 1 from b where num=a.num)

    应尽量避免在where子句中对字段进行函数操作,这将导致引擎放弃使用索引而进行全表扫描。如:
    select id from t where substring(name,1,3) = ’abc’ --name以abc开头的id
    select id from t where datediff(day,createdate,’2005-11-30′) = 0 -–‘2005-11-30’ --生成的id

    =====================================================
    http://www.cnblogs.com/sosoft/p/3533306.html
    MySQL性能优化的20条经验

  • 相关阅读:
    问题堆栈区39+40
    ListView优化分页优化
    AsyncTask理解- Day36or37
    Activity是如何挂载Pargment的Day35
    BroadcastReceiver和Intetnt的理解 Day34
    深入理解自定义ListView
    手势识别=读取手机联系人=ContentResolver-Day3
    Android本地JUnit Text
    Java——(一)一切都是对象
    SciTE: 中文字符支持问题
  • 原文地址:https://www.cnblogs.com/wsl222000/p/4950402.html
Copyright © 2011-2022 走看看