pt-fingerprint
pt-fingerprint:官方地址
说明
用途:将SQL语句转换为绑定变量形式,即:所有where条件中指定的具体值以?
代替。
语法:
pt-fingerprint [OPTIONS] [FILES]
具体例子
[root@BigData ~]# pt-fingerprint --query "select a, b, c from users where id = 500 and price > 100"
select a, b, c from users where id = ? and price > ?
[root@BigData ~]# pt-fingerprint --query "INSERT INTO product(ID,NAME,PRICE) VALUES(1,'apple',100)"
insert into product(id,name,price) values(?+)
也可以将所有SQL语句放入文本文件中,然后一次性转换所有语句
pt-fingerprint sql.txt