diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-11-07 21:53:55 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-11-07 21:53:55 +0000 |
commit | f01bd675c0a6cb2d7832053cef23718d9783d8f9 (patch) | |
tree | 3edf5942363837ace9e5e8cade0cca5deb949884 /modules/user.module | |
parent | 7a5884cd74c2c1d1fa19bede7805ed8be9a2053d (diff) | |
download | brdo-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/user.module')
-rw-r--r-- | modules/user.module | 2 |
1 files changed, 1 insertions, 1 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); |