Skip to content

otheus/MySQL-Proxy-scripts-for-devs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySQL Proxy scripts for devs

This is a repository of useful MySQL Proxy scripts targetting mainly developers in quest of debugging.

Requirements

MySQL Proxy >= 0.8 (May work with earlier version, untested)

Running

$ mysql-proxy --proxy-lua-script=/absolute/path/to/the/script.lua

Scripts

debug.lua

Prints every SQL command received while cleaning obsolete spaces. Every command appears on one line with the following additional information:

  • an optional informative message about the query,
  • the number of rows returned or affected by the query,
  • the amout of time (in ms) it took to run the query.

Additionally, colors are used to provide direct information on the queries:

  • yellow: when not using a good index (no_good_index_used flag),
  • yellow + bold: when not using an index at all,
  • red: when an error occured,
  • pink: for queries affecting records.

Colors are also used to denote slow queries: time displayed in red instead of green. When a query returns no rows nor affect records, "" is displayed using red in reverse video.

debug-blind.lua

Same as debug.lua, but without shell colors.

slow.lua

Simulates a server being slow because of huge traffic.

The sleep command accepting a float as argument is required to make this script works out of the box.

The slowdowns can be configured to make all requests longer by a factor or by a fixed amount of time (or both).

By default, requests are made twice slower with an additional overhead of 0.1s.

About

MySQL-Proxy scripts for devs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Lua 100.0%