From fa1f6d7454edcb8e30b9b0bdb14f1ec040546715 Mon Sep 17 00:00:00 2001
From: marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>
Date: Mon, 6 Oct 2008 16:25:28 +0000
Subject: Closes #402 and #407 : Right! Finally nailed this fscking issue to
 the wall (hopefully).

Modified system log to hold extra information about the class being stored, this lets us pull only the required rows from the event log.

This drastically simplifies and speeds up the query.

Requires: Database upgrade.
Outstanding issues: Query is using filesort despite using correct index. Still much faster than the last method!

git-svn-id: https://code.elgg.org/elgg/trunk@2194 36083f99-b078-4883-b0ff-0f9b5a30f544
---
 engine/schema/upgrades/2008100601.sql | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

(limited to 'engine/schema/upgrades/2008100601.sql')

diff --git a/engine/schema/upgrades/2008100601.sql b/engine/schema/upgrades/2008100601.sql
index 89cce2e0e..2576487bd 100644
--- a/engine/schema/upgrades/2008100601.sql
+++ b/engine/schema/upgrades/2008100601.sql
@@ -1,2 +1,13 @@
-ALTER TABLE `prefix_system_log` ADD COLUMN `object_type` varchar(128) NOT NULL AFTER `object_class`;
-ALTER TABLE `prefix_system_log` ADD COLUMN `object_subtype` varchar(128) NOT NULL AFTER `object_type`;
\ No newline at end of file
+ALTER TABLE `prefix_system_log` ADD COLUMN `object_type` varchar(50) NOT NULL AFTER `object_class`;
+ALTER TABLE `prefix_system_log` ADD COLUMN `object_subtype` varchar(50) NOT NULL AFTER `object_type`;
+ALTER TABLE `prefix_system_log` MODIFY  `object_type` varchar(50) NOT NULL;
+
+
+ALTER TABLE `prefix_system_log` DROP KEY `object_type`;
+ALTER TABLE `prefix_system_log` DROP KEY `object_subtype`;
+ALTER TABLE `prefix_system_log` DROP KEY `river_key`;
+
+ALTER TABLE `prefix_system_log` ADD KEY `object_type` (`object_type`);
+ALTER TABLE `prefix_system_log` ADD KEY `object_subtype` (`object_subtype`);
+
+ALTER TABLE `prefix_system_log` ADD KEY `river_key` (`object_type`, `object_subtype`, `event`);
\ No newline at end of file
-- 
cgit v1.2.3

