Saturday, August 22, 2009

What is QEP?

In the context of database programming, QEP is an acronym for Query Execution Plan.

The database server analyzes every SQL query and plans how to use indexes and order tables to produce the result in the most efficient way.

You can get a report of the QEP for a SELECT query using the EXPLAIN command in MySQL. This is an important tool to analyze your SQL queries and detect inefficiencies.

Consultant Ronald Bradford uses the acronym QEP freely, but this term is not ubiquitous and doesn't appear in the MySQL documentation. Googling for QEP yields some confusing results:

Remember: if you are using an uncommon acronym in your writing, define it when you use it. Even if you have used the acronym in past blog posts, define it again in a new blog post. Or at least link to the original post where you defined it.

2 comments:

Timour said...

I bumped into your blog post while looking for something else. Anyway, you are wrong to say that the term QEP has not been used within MySQL. Check this for a start: http://forge.mysql.com/wiki/MySQL_Internals_Optimizer

Both myself and other MySQL optimizer developers have given a number of presentations where the QEP representation of MySQL has been explained.

This year (now as a member of the MariaDB server team), I submitted a conference proposal to MySQL UC'2010, for a presentation that will focus explicitly on the representation and algorithms of MariaDB's and MySQL's QEPs. If the presentation is accepted, you are most welcome to join.

Bill Karwin said...

Hi Timour, thanks for the comment and the references. Good luck with your presentation!

I mean the MySQL manual specifically. The words "query execution plan" appears in two sections and also in the changelog, but nowhere are these words given the acronym QEP.

Regardless, this acronym is uncommon at best, so it's good style to define it before using it. The article in MySQL Forge does this:

"A combination of a fixed order in which tables are joined and the corresponding table access methods for each table is called query execution plan (QEP)."