MacOS下安裝小米SQL優化工具soar

1 下載源碼包 賦予權限git

  wget https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.darwin-amd64 -O soar
  chmod a+x soar

 

 

2 安裝Go語言github

brew install -y go

發現版本不對,直接去https://golang.org/dl/下載Mac下的pkg安裝包golang

添加安裝路徑到path下vim

vim ~/.bash_profile
export PATH="/usr/local/go/bin:$PATH"
退出編輯模式
source ~/.bash_profile

 

3 源碼安裝bash

go get -d github.com/XiaoMi/soar cd ${GOPATH}/src/github.com/XiaoMi/soar && make

4 而後測試安裝是否成功session

cd ${GOPATH}/src/github.com/XiaoMi/soar/bin
echo 'SELECT SUM(CASE a.status WHEN 101005 THEN a.duration / 60.0 * a.rate WHEN '101001' THEN a.duration / 60.0 * a.rate WHEN '101004' THEN 0 - a.duration / 60.0 * a.rate ELSE a.duration / 60.0 * a.rate END) AS money2, a.teacher_id, b.first_name, b.last_name , b.avatar, b.paypal_account FROM `t_coursesession` a LEFT JOIN t_teacher b ON a.teacher_id = b.teacher_id WHERE (((a.status = 101005 OR a.status = 101001 OR a.status = 101004)) AND b.is_delete = 0 AND a.is_delete = 0) GROUP BY a.teacher_id ORDER BY money2 DESC' | ./soar

結果顯示:測試

 

 SQL優化利器,簡單方便實用。優化

相關文章
相關標籤/搜索