summaryrefslogtreecommitdiff
path: root/includes
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 /includes
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 'includes')
-rw-r--r--includes/session.inc2
1 files changed, 1 insertions, 1 deletions
diff --git a/includes/session.inc b/includes/session.inc
index 91351d7d4..5155dab7f 100644
--- a/includes/session.inc
+++ b/includes/session.inc
@@ -25,8 +25,8 @@ function sess_read($key) {
$result = db_query_range("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = '%s' AND u.status < 3", $key, 0, 1);
if (!db_num_rows($result)) {
- $result = db_query("SELECT u.* FROM {users} u WHERE u.uid = 0");
db_query("INSERT INTO {sessions} (uid, sid, hostname, timestamp) values(%d, '%s', '%s', %d)", $user->uid, $key, $_SERVER["REMOTE_ADDR"], time());
+ $result = db_query("SELECT u.* FROM {users} u WHERE u.uid = 0");
}
$user = db_fetch_object($result);