Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.42
diff -u -F^f -r1.42 system.install
--- modules/system/system.install	22 Nov 2006 09:16:48 -0000	1.42
+++ modules/system/system.install	24 Nov 2006 10:17:45 -0000
@@ -541,7 +541,8 @@ function system_install() {
         referer varchar(128) NOT NULL default '',
         hostname varchar(128) NOT NULL default '',
         timestamp int NOT NULL default '0',
-        PRIMARY KEY (wid)
+        PRIMARY KEY (wid),
+        KEY (type)
       ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
 
       break;
@@ -1007,6 +1008,7 @@ function system_install() {
         timestamp int NOT NULL default '0',
         PRIMARY KEY (wid)
       )");
+      db_query("CREATE INDEX {watchdog}_type_idx ON {watchdog} (type)");
       break;
   }
 
@@ -3376,6 +3378,23 @@ function system_update_1014() {
 }
 
 /**
+ * Add an index on watchdog type.
+ */
+function system_update_1015() {
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql('ALTER TABLE {watchdog} ADD INDEX (type)');
+      break;
+    case 'pgsql':
+      $ret[] = update_sql('CREATE INDEX {watchdog}_type_idx ON {watchdog}(type)');
+      break;
+  }
+  return $ret;
+}
+
+/**
  * @} End of "defgroup updates-4.7-to-x.x"
  */
 
