Hacking with PHP has been updated for PHP 7 - click here! >>

Know MySQL's strengths

Although MySQL is a fast DBMS all-round, there are some things it does particularly well. We have covered the majority here, but there is one particular optimisation you should be aware of, and that is that the following syntax is particularly fast:

SELECT foo FROM bar WHERE baz IN (constant1, constant2, constant3);

This holds true even if you have a fairly long list of constants for the IN clause.

 

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Server >>

Previous chapter: Benchmark, benchmark, benchmark!

Jump to:

 

Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.