summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-10-03 11:42:52 +0000
committerDries Buytaert <dries@buytaert.net>2003-10-03 11:42:52 +0000
commit630325188ac228f5cb1919b2ce48716ccbdc7e4e (patch)
treeed6f6f12e03d639241a1fda94395516618479927
parent95f3278e0eb567eac7bb40e270ee79be7b7867e0 (diff)
downloadbrdo-630325188ac228f5cb1919b2ce48716ccbdc7e4e.tar.gz
brdo-630325188ac228f5cb1919b2ce48716ccbdc7e4e.tar.bz2
- Performance improvement: removed redundant inner join. Patch by Kjartan.
-rw-r--r--modules/comment.module2
-rw-r--r--modules/comment/comment.module2
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/comment.module b/modules/comment.module
index f77dd65d9..caaca8f09 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -1470,7 +1470,7 @@ function comment_num_all($nid) {
static $cache;
if (!isset($cache[$nid])) {
- $comment = db_fetch_object(db_query("SELECT COUNT(c.nid) AS number FROM {node} n INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = %d AND c.status = 0 GROUP BY n.nid", $nid));
+ $comment = db_fetch_object(db_query("SELECT COUNT(nid) AS number FROM {comments} WHERE nid = %d AND status = 0 GROUP BY nid", $nid));
$cache[$nid] = $comment->number ? $comment->number : 0;
}
return $cache[$nid];
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index f77dd65d9..caaca8f09 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1470,7 +1470,7 @@ function comment_num_all($nid) {
static $cache;
if (!isset($cache[$nid])) {
- $comment = db_fetch_object(db_query("SELECT COUNT(c.nid) AS number FROM {node} n INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = %d AND c.status = 0 GROUP BY n.nid", $nid));
+ $comment = db_fetch_object(db_query("SELECT COUNT(nid) AS number FROM {comments} WHERE nid = %d AND status = 0 GROUP BY nid", $nid));
$cache[$nid] = $comment->number ? $comment->number : 0;
}
return $cache[$nid];