Discussion about Remove COUNT(*) from path_cache patch

Events happening in the community are now at Drupal community events on www.drupal.org.
navaneeth_r's picture

Please refer: http://drupal.org/node/230235

Thanks for the patch, it gives a good performance benefit.
if (!isset($count)) {
//$count = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}'));
$count = (int)db_result(db_query('SELECT pid FROM {url_alias} LIMIT 1'));
}
Here the $count variable is used to indicate that a url alias has been created. Can't we use $count =1 or session variable like $_SESSION['count'] instead of running the query "(int)db_result(db_query('SELECT pid FROM {url_alias} LIMIT 1'));" ?.
In a site with a large and growing node table where we are in any way sure that there are alias, do we really require to have this query on every page load? This is one of the more time consuming queries as it uses the node table.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: