Optimizing Views queries - a mini case-study
Submitted by Jakub Suchý on Fri, 05/14/2010 - 15:51I am sure anyone has ever created a Drupal View that is not ideal and should be made better. But in the same time, if you have a high-traffic site, you might find it hard to redo such a view due to any dependencies that the view might have. This mini showcase will provide some info on how we managed to fix the view without changing it - by altering it's query.
We have been approached with problems on one site that uses a very complex view with a query that usually takes more than 9 seconds on MySQL. The query was frightening:
<?php
Jakub is owner and founder of Dynamite Heads. Jakub is a member of Drupal Security Team and supports Czech Drupal community at Drupal.cz