Anaconda And Tsinghua University Open Source Software Mirror Station Posted on 2020-06-24 | In Python | | Visitors: ℃ Words count in article: 361 | Reading time ≈ 1 Anaconda And Tsinghua University Open Source Software Mirror Stationanaconda更新镜像 清华源 https://mirrors-i.tuna.tsinghua.edu.cn/ 查看cond config配置详细说明 conda config -h conda info 查看添加源信息 删除清华源,改为默认源 conda config –remove-key channels Read more »
how to optimize sql Posted on 2020-05-06 | In sql | | Visitors: ℃ Words count in article: 825 | Reading time ≈ 3 how to optimize sql 无法使用index 情况 使用负向条件查询,导致索引失效 使用模糊查询,前导模糊查询不能是索引生效,而后置模糊查询可以 数据区分度不大的字段 不宜使用索引 运算式中的字段无法使用其上的索引,或者说在属性上进行计算无法命中其索引 存在null值的列,如果建立索引,查询会存在隐患 复合索引最左前缀原则 把计算放到业务层而不是数据库层,除了节省数据的CPU,还有意想不到的查询缓存优化效果 条件中用or(新版本应该行),即使其中有条件带索引,也不会使用索引查询 如果列类型是字符串,那一定要在条件中将数据使用引号引用起来,否则不会使用索引 强制类型转换会全表扫描 如果MySQL预计使用全表扫描要比使用索引快,则不使用索引 在索引上做任何操作都会造成索引失效,而使用全局扫描 对索引列运算,运算包括(+、-、*、/、!、<>、%、like’%_’(%放在前面)、or、in、exist等),导致索引失效。 mysql使用!= ,<> ,is null ,is not null会使索引失效 union all 肯定是能够命中索引的 如果业务大部分是单条查询,使用Hash索引性能更好,例如用户中心 如果明确知道只有一条结果返回,limit 1能够提高效率 加索引,左连接,加右表上,反之 Exists select …from table wherer exists(subquery 子查询) 将主查询的数据,放到子查询中做条件验证,根据验证结果(True or False) 来决定主查询的数据结果是否得以保留 exists子查询往往也可以用条件表达式,其他子查询或者join来替代,何种最优需要具体问题具体分析。 exists只返回True or False ,因此子查询中select * 也可以是select 1 or select ‘x’ 官方说法是实际执行时会忽略select清单,因此没有区别 Read more »
how to optimize hive Posted on 2020-05-06 | In sql | | Visitors: ℃ Words count in article: 711 | Reading time ≈ 2 how to optimize hive hive tutorial https://cwiki.apache.org/confluence/display/Hive/Tutorial Hive SQL的编译过程 https://tech.meituan.com/2014/02/12/hive-sql-to-mapreduce.html hive的map reduce 执行顺序 https://zhipengyeve.wang/2019/02/02/hiveSQL%E7%9A%84%E6%89%A7%E8%A1%8C%E9%A1%BA%E5%BA%8F%E4%BB%A5%E5%8F%8Ahive%E4%BC%98%E5%8C%96/ hive优化 https://www.iteye.com/blog/daizj-2289981 Read more »
chapter16-sort-algorithm Posted on 2020-03-08 | In leetcode | | Visitors: ℃ Words count in article: 1.5k | Reading time ≈ 6 chapter16-sort-algorithm[TOC] Read more »
chapter15-unionFindSets-algorithm Posted on 2020-03-04 | In leetcode | | Visitors: ℃ Words count in article: 603 | Reading time ≈ 3 chapter15-unionFindSets-algorithm[TOC] Read more »