[drupal-devel] [feature] Block query consolidation

Allie Micka drupal-devel at drupal.org
Fri Sep 9 20:12:05 UTC 2005


Issue status update for 
http://drupal.org/node/30801
Post a follow up: 
http://drupal.org/project/comments/add/30801

 Project:      Drupal
 Version:      4.6.0
 Component:    block.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Allie Micka
 Updated by:   Allie Micka
 Status:       patch (code needs review)
 Attachment:   http://drupal.org/files/issues/block_query.patch (1.25 KB)

The blocks module is running a separate query for each region, e.g.:


   SELECT * FROM blocks WHERE theme = 'bluemarine' AND status = 1 AND
region='left' ORDER BY weight, module
   SELECT * FROM blocks WHERE theme = 'bluemarine' AND status = 1 AND
region='right' ORDER BY weight, module
   SELECT * FROM blocks WHERE theme = 'bluemarine' AND status = 1 AND
region='header' ORDER BY weight, module
   SELECT * FROM blocks WHERE theme = 'bluemarine' AND status = 1 AND
region='footer' ORDER BY weight, module


Ultimately, we're going to need all of these so let's save a few
queries.  I have changed the query to:


   SELECT * FROM blocks WHERE theme = 'bluemarine' AND status = 1 ORDER
BY region, weight, module


And set all results to the static $blocks array on the first pass.




Allie Micka




More information about the drupal-devel mailing list