From f01bd675c0a6cb2d7832053cef23718d9783d8f9 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 7 Nov 2004 21:53:55 +0000 Subject: - 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. --- includes/session.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'includes') 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); -- cgit v1.2.3