Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sqladvisor- comments on sql statement Optimization tool

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Github address:

Https://github.com/Meituan-Dianping/SQLAdvisor/blob/master/doc/QUICK_START.md

Installation method:

Install dependency packages

Yum-y install cmake libaio-devel libffi-devel glib2 glib2-devel

Yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm

Yum-y install Percona-Server-shared-56

Cd / usr/lib64/

Ln-s libperconaserverclient_r.so.18 libperconaserverclient_r.so

Compile dependency sqlparser

# yum install git-y

# git clone https://github.com/Meituan-Dianping/SQLAdvisor.git

A.cd SQLAdvisor

B.cmake-DBUILD_CONFIG=mysql_release-DCMAKE_BUILD_TYPE=debug-DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser.

C.make & & make install

Install SQLAdvisor source code

A. Cd SQLAdvisor/sqladvisor/

B. cmake-DCMAKE_BUILD_TYPE=debug. /

C. Make

d. Generate a sqladvisor executable file under this path, which is what we want.

SQLAdvisor usage

. / sqladvisor-- help

Usage:

Sqladvisor [OPTION...] Sqladvisor

SQL Advisor Summary

Help Options:

-help Show help options.

Application Options:

-f,-- defaults-file sqls file

-u,-- username username

-p,-- password password

-P,-- port port

-h,-- host host

-d,-- dbname database name

-Q,-- sqls sqls

-v,-- verbose 1:output logs 0:output nothing

Command line parameter transfer call

. / sqladvisor-h xx-P xx-u xx-p 'xx'-d xx-Q "sql"-v 1

Note: when passing parameters on the command line, the parameter name and value need to be separated by a space

Configuration file parameter transfer call

$> cat sql.cnf

[sqladvisor]

Username=xx

Password=xx

Host=xx

Port=xx

Dbname=xx

Sqls=sql1;sql2;sql3....

Cmd:. / sqladvisor-f sql.cnf-v 1

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 216

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report