Skip to content

Instantly share code, notes, and snippets.

SQL Stunts sqlstunts

Block or report user

Report or block sqlstunts

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
@sqlstunts
sqlstunts / livequeries.sql
Created Jan 22, 2016
Get live queries from MySQL instance in real time.
View livequeries.sql
SELECT
plist.id, plist.user, plist.host, plist.db,
plist.command, plist.TIME, plist.state,
plist.info, trx.trx_state,
trx.trx_wait_started,
trx.trx_query, blockerw.blocking_trx_id,
(CASE
WHEN (blockerw.blocking_trx_id IS NOT NULL) THEN 'Blocked'
WHEN (lockedtr.trx_id IS NOT NULL) THEN 'Locked'
ELSE ''
@sqlstunts
sqlstunts / footprint.sql
Created Nov 25, 2015
Script to gather a fast summary on a MySQL database server.
View footprint.sql
#Information about the server
select @@hostname as 'host',@@version_compile_os as 'OS',
@@version as 'Server Version',@@collation_server as 'Default collation',
@@version_compile_machine as 'Server Binary',
@@basedir as 'Binaries Folder', @@datadir as 'Data Folder';
#Information about the databases
#Number of databases
select count(schema_name) as 'Number of DB' from
INFORMATION_SCHEMA.schemata
@sqlstunts
sqlstunts / refactor_grt.py
Created Sep 29, 2015
Refactor plugin for MySQL Workbench.
View refactor_grt.py
# import the wb module
from wb import *
# import the grt module
import grt
# import the mforms module for GUI stuff
import mforms
# define this Python module as a GRT module
ModuleInfo = DefineModule(name="Refactor", author="mjlmo", version="0.1")
View print-tsv-to-table.py
import csv
from tabulate import tabulate
if __name__ == '__main__':
report_headers = []
data = []
with open('data.csv','r') as f:
reader=csv.reader(f,delimiter='\t')
You can’t perform that action at this time.