This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python2.7 | |
""" | |
This script dump proxysql digest from `stats_mysql_query_digest` periodically but not too often. | |
In order to show the trends, difference is caculated to save to mysql table. Also print influxdb format. | |
`ProxySQL_Info` and `MySQL_Digest` should be given! | |
""" | |
import MySQLdb | |
import time | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> show mysql variables; | |
+----------------------------------------+--------------------------------------+ | |
| Variable_name | Value | | |
+----------------------------------------+--------------------------------------+ | |
| mysql-client_found_rows | true | | |
| mysql-commands_stats | true | | |
| mysql-connect_retries_delay | 1 | | |
| mysql-connect_retries_on_failure | 10 | | |
| mysql-connect_timeout_server | 3000 | | |
| mysql-connect_timeout_server_max | 10000 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"steps": [ | |
{ | |
"join_preparation": { | |
"select#": 1, | |
"steps": [ | |
{ | |
"expanded_query": "/* select#1 */ select `t_tbl_test_time_08`.`f_some_id` AS `f_some_id` from `t_tbl_test_time_08` where ((`t_tbl_test_time_08`.`f_qiye_id` = 5077665) and (`t_tbl_test_time_08`.`f_type` = 9) and (`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53')) order by `t_tbl_test_time_08`.`f_some_id` limit 300" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"steps": [ | |
{ | |
"join_preparation": { | |
"select#": 1, | |
"steps": [ | |
{ | |
"expanded_query": "/* select#1 */ select `t_tbl_test_time_08`.`f_some_id` AS `f_some_id` from `t_tbl_test_time_08` USE INDEX (`f_contact_time`) where ((`t_tbl_test_time_08`.`f_qiye_id` = 5077665) and (`t_tbl_test_time_08`.`f_type` = 9) and (`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53')) order by `t_tbl_test_time_08`.`f_some_id` limit 300" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"steps": [ | |
{ | |
"join_preparation": { | |
"select#": 1, | |
"steps": [ | |
{ | |
"expanded_query": "/* select#1 */ select `t_tbl_test_time_08`.`f_some_id` AS `f_some_id` from `t_tbl_test_time_08` where ((`t_tbl_test_time_08`.`f_qiye_id` = 5077665) and (`t_tbl_test_time_08`.`f_type` = 9) and (`t_tbl_test_time_08`.`f_contact_time` > '2017-10-17 14:23:49') and (`t_tbl_test_time_08`.`f_contact_time` < '2017-10-17 14:23:53')) order by `t_tbl_test_time_08`.`f_some_id` limit 8168" | |
} | |
] |