Skip to content

Instantly share code, notes, and snippets.

@Katamori
Created March 12, 2018 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Katamori/a33d411f96213000e642c5f8f42e998a to your computer and use it in GitHub Desktop.
Save Katamori/a33d411f96213000e642c5f8f42e998a to your computer and use it in GitHub Desktop.
MySQL profiling

Mostly from this.

Made for rule-of-thumb; you need to understand SQL well to modify these queries for your own taste.

Start and use profiling

SET @@profiling=1; SET @@profiling_history_size = 100;

Overview

general list: SHOW profiles; get query time: SELECT sum(duration) from information_schema.profiling where query_id=<query id from 'profiles'>; Exact details on query: SHOW profile for query 1;

Stop profiling

SET @@profiling = 0; SET @@profiling_history_size = 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment