Conclusion and summary of the guidelines

Last updated on
8 September 2016

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

  1. Use a collection of SQL performance tools, including Drupal Devel module, database server-side logging and an SQL client. You will need these three tools, install them and learn to use them.
  2. Log slow SQL queries server-side in the database. SQL query should always execute in less than 30 ms in the database. If not, they should be logged.
  3. Use Drupal Devel module for a first analysis of these queries.
  4. Run EXPLAIN on slow queries in the SQL client to find sequential scans.
  5. Sequential scans are your enemies, especially if you plan to run your code on large servers. Try to understand when CPU time is lost. Follow simple rules to write queries which do not imply any sequential scan or very rarely. This will drive down CPU time and improve the quality of your code.

Help improve this page

Page status: No known problems

You can: