小米 SOAR 开源SQL优化工具安装

来源:这里教程网 时间:2026-03-01 12:03:31 作者:

github :https://github.com/xiaomi/soar 安装说明 :https://github.com/XiaoMi/soar/blob/master/doc/install.md 源码下载 :https://GOlang.google.cn/dl/ 配置环境变量: tar -C /usr/local -xvf go1.12.5.linux-amd64.tar 全局用户变量: vi /etc/profile 末尾添加: export PATH=$PATH:/usr/local/go/bin go版本查看: # go version source更新环境变量: source /etc/profile 还需要配置GOPATH环境变量:表示go的工作目录 USER_NAME 为用户名 export GOPATH="/home/USER_NAME/go" [root@b28-17-55 XiaoMi]# pwd /home/USER_NAME/go/src/github.com/XiaoMi [root@b28-17-55 opt]# mv soar-master.zip /home/USER_NAME/go/src/github.com/XiaoMi [root@b28-17-55 XiaoMi]# unzip soar-master.zip [root@b28-17-55 XiaoMi]# mv soar-master soar [root@b28-17-55 soar]# make 若安装顺利,最终会显示success。否则 build error 常用命令 :https://github.com/XiaoMi/soar/blob/master/doc/cheatsheet.md [root@b28-17-55 bin]# echo 'select * from film' | ./soar # Query: 687D590364E29465 ★ ★ ★ ☆ ☆ 75分 ```sql SELECT     *  FROM     film ``` ## 最外层 SELECT 未指定 WHERE 条件 * **Item:**  CLA.001 * **Severity:**  L4 * **Content:**  SELECT 语句没有 WHERE 子句,可能检查比预期更多的行(全表扫描)。对于 SELECT COUNT(\*) 类型的请求如果不要求精度,建议使用 SHOW TABLE STATUS 或 EXPLAIN 替代。 ## 不建议使用 SELECT * 类型查询 * **Item:**  COL.001 * **Severity:**  L1 * **Content:**  当表结构变更时,使用 \* 通配符选择所有列将导致查询的含义和行为会发生更改,可能导致查询返回更多的数据。

相关推荐