How to ask for help with MySQL Performance

Since discovering StackOverflow I’ve become hopelessly addicted (see the badge to the right).
I answer the mysql, php, zend-framework, and javascript categories mostly.

My favorite category is mysql. These can be some of the most challenging questions to answer, particularly the
query optimization ones. I often answer, having learned something myself in the process.

Unfortunately, given the vast number of users, there are a lot of communication inconsistencies. It drives me
batshit-crazy to read a textual description of a table. So I created a simple guide to getting people to help you with
MySQL queries.

  • SHOW CREATE TABLE – this is the best way to show someone your table schema. Don’t try to describe it using
    plain-English, it just isn’t good enough. This exposes your columns, field types (you said TIMESTAMP but you really
    have a DATETIME), and your indices all in one query.
  • USE EXPLAIN – EXPLAINing your queries shows others where to start. It’s ok if you don’t understand it completely,
    but read the documentation for the basics.
  • USE \G – You have two ways to delimit your MySQL queries when using the mysql client. Using the DELIMITER, ; by
    default – or using \G. This turns your columnar data into row data and limits the width to 80 chars. This is
    ideal for displaying on the web.

Read the full article on StackOverflow.

One Response to How to ask for help with MySQL Performance

  1. Scott November 28, 2013 at 12:41 #

    Hi Dave

    i recently get corrupted checks on mysql RT database checks. I think because of a sudden stop start of mysql.

    I have zfs on my system.I have copies of RT files as snapshots. I can see my RT directory in mysql hasn’t changed in snapshots so I dont’ think the corruption is correct.
    The RT database is an INNoDB. When I show engines the INNODB is dissabled. Not sure why.

    My RT isn’t coming up in mysql I am frieghtened about any changes at this point. IS there any chance you could assist?

    Thanks and Regards

Leave a Reply