summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-11-07 21:53:55 +0000
committerDries Buytaert <dries@buytaert.net>2004-11-07 21:53:55 +0000
commitf01bd675c0a6cb2d7832053cef23718d9783d8f9 (patch)
tree3edf5942363837ace9e5e8cade0cca5deb949884 /modules
parent7a5884cd74c2c1d1fa19bede7805ed8be9a2053d (diff)
downloadbrdo-f01bd675c0a6cb2d7832053cef23718d9783d8f9.tar.gz
brdo-f01bd675c0a6cb2d7832053cef23718d9783d8f9.tar.bz2
- Performance improvement: made 'sid' the primary key of the sessions table.
That should improve performance of session handling as well improve performance of the "Who's online"-block. Drupal.org's sessions table contains appr. 40.000 sessions on a slow day and rendering the "Who's online"-block became a performance bottleneck. This change has yet to be tested on a busy site so things might go wrong.
Diffstat (limited to 'modules')
-rw-r--r--modules/user.module2
-rw-r--r--modules/user/user.module2
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/user.module b/modules/user.module
index 7c5ca77be..d6ee673df 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -563,7 +563,7 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
$time_period = variable_get('user_block_seconds_online', 2700);
// Perform database queries to gather online user lists.
- $guests = db_fetch_object(db_query('SELECT COUNT(DISTINCT(sid)) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
+ $guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
$users = db_query('SELECT DISTINCT(uid), MAX(timestamp) AS max_timestamp FROM {sessions} WHERE timestamp >= %d AND uid != 0 GROUP BY uid ORDER BY max_timestamp DESC', time() - $time_period );
$total_users = db_num_rows($users);
diff --git a/modules/user/user.module b/modules/user/user.module
index 7c5ca77be..d6ee673df 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -563,7 +563,7 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
$time_period = variable_get('user_block_seconds_online', 2700);
// Perform database queries to gather online user lists.
- $guests = db_fetch_object(db_query('SELECT COUNT(DISTINCT(sid)) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
+ $guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
$users = db_query('SELECT DISTINCT(uid), MAX(timestamp) AS max_timestamp FROM {sessions} WHERE timestamp >= %d AND uid != 0 GROUP BY uid ORDER BY max_timestamp DESC', time() - $time_period );
$total_users = db_num_rows($users);