Skip to content

Instantly share code, notes, and snippets.

Sean Chow seanlook

Block or report user

Report or block seanlook

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@seanlook
seanlook / gen_navicat_conn.py
Created Nov 11, 2017
简单写了个脚本,根据Navicat导出的格式,生成EC目前在测试和开发环境所有MySQL实例的连接地址。 使用者只需要将当前目录下 connections.ncx 和 vgroup.xml 放到navicat适当目录下,即可获得所有地址信息,不需要再逐个手动添加
View gen_navicat_conn.py
import pymysql
from collections import defaultdict
"""
This script is used to generate Navicat connections list to save your time adding many MySQL connection info to Navicat GUI.
output: (in current directory)
- connections.ncx: import it to navicat
- vgroup.xml: move it to navicat Profile location, usually C:\Users\ecuser\Documents\Navicat\Premium\profiles
View order_by_limit_trace_biglimit.json
{
"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"
}
]
View order_by_limit_trace_useindex.json
{
"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"
}
]
View order_by_limit_trace_default.json
{
"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"
}
]
@seanlook
seanlook / sh
Created Jul 27, 2017
proxysql variables
View sh
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 |
@seanlook
seanlook / py
Created Jul 19, 2017
collect digests from proxysql periodically
View py
#!/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
You can’t perform that action at this time.