Lea Verou 3/25/2010

MySQL: Are you actually utilizing your indexes?

Read Original

This technical article demonstrates how subtle differences in MySQL query syntax can dramatically impact performance. By changing a WHERE clause from 'UNIX_TIMESTAMP(NOW()) - post.dateline < 86400' to 'post.dateline > UNIX_TIMESTAMP(NOW()) - 86400', query time dropped from ~10 seconds to 0.03 seconds. The author explains how the second query allows MySQL to properly utilize the B+ tree index on the dateline column, with execution plan analysis using EXPLAIN to show the performance difference.

MySQL: Are you actually utilizing your indexes?

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

2
Designing Design Systems
TkDodo Dominik Dorfmeister 2 votes
4
Introducing RSC Explorer
Dan Abramov 1 votes
6
Fragments Dec 11
Martin Fowler 1 votes
7
Adding Type Hints to my Blog
Daniel Feldroy 1 votes
8
Refactoring English: Month 12
Michael Lynch 1 votes
10