0%

索引失效情况:索引使用

使用explain 分析索引是否使用

 explain select *from tbl_file where file_sha1='0c4b1036671ad0b2727a9d18349d02feae0e8161';
+----+-------------+----------+------------+-------+---------------+---------------+---------+-------+------+----------+-------+
| id | select_type | table    | partitions | type  | possible_keys | key           | key_len | ref   | rows | filtered | Extra |
+----+-------------+----------+------------+-------+---------------+---------------+---------+-------+------+----------+-------+
|  1 | SIMPLE      | tbl_file | NULL       | const | idx_file_hash | idx_file_hash | 120     | const |    1 |   100.00 | NULL  |
+----+-------------+----------+------------+-------+---------------+---------------+---------+-------+------+----------+-------+
1 row in set, 1 warning (0.00 sec)

possible_keys :可能索引 key:索引键

阅读全文 »

Linux 最常用命令!

Linux是目前应用最广泛的服务器操作系统,基于Unix,开源免费,由于系统的稳定性和安全性,市场占有率很高,几乎成为程序代码运行的最佳系统环境。

linux不仅可以长时间的运行我们编写的程序代码,还可以安装在各种计算机硬件设备中,如手机、路由器等,Android程序最底层就是运行在linux系统上的。

linux的目录结构

阅读全文 »

1. 多个defer语句,按先进后出的方式执行

package main 
import "fmt" 
func main() {    
    var whatever [5]struct{s}    
    for i := range whatever {
        defer fmt.Println(i)    
    } 
}

//4
//3
//2
//1
//0
阅读全文 »