Skip to content

Instantly share code, notes, and snippets.

View JonnoN's full-sized avatar

Jonathan Nicol JonnoN

  • looking for work
  • Seattle, WA
View GitHub Profile
@JonnoN
JonnoN / gist:5c7a36017d38caa3a2d70cea77fd9ac8
Last active September 17, 2019 20:34
SQL for measuring binlog group commit efficiency
-- (run this all at once)
set @binlog_commits_1 = (select variable_value from information_schema.global_status where variable_Name = 'Binlog_commits');
set @binlog_group_commits_1 = (select variable_value from information_schema.global_status where variable_Name = 'Binlog_group_commits');
set @trigger_count_1 = (select variable_value from information_schema.global_status where variable_Name = 'Binlog_group_commit_trigger_count');
set @trigger_timeout_1 = (select variable_value from information_schema.global_status where variable_Name = 'Binlog_group_commit_trigger_timeout');
select sleep(60);
set @binlog_commits_2 = (select variable_value from information_schema.global_status where variable_Name = 'Binlog_commits');
set @binlog_group_commits_2 = (select variable_value from information_schema.global_status where variable_Name = 'Binlog_group_commits');
set @trigger_count_2 = (select variable_value from information_schema.global_status where variable_Name = 'Binlog_group_commit_trigger_count');
set @trigger_
@JonnoN
JonnoN / information_schema.sql
Last active January 23, 2024 22:22
mysql information_schema copypasta
use information_schema;
select table_schema, sum(data_length)/1024/1024/1024 as data_gb, sum(index_length)/1024/1024/1024 as index_gb, sum(data_free)/1024/1024/1024 as free_gb from tables group by table_schema;
select table_schema, table_name, data_length/1024/1024/1024 as data_gb, index_length/1024/1024/1024 as index_gb, data_free/1024/1024/1024 as free_gb from tables where table_schema not in ('mysql', 'information_schema', 'performance_schema', 'sys') order by data_gb;