]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 824361: Add an index on (bug_id, work_time) in the longdescs table to improve...
authorFrédéric Buclin <LpSolit@gmail.com>
Mon, 7 Jan 2013 20:11:53 +0000 (21:11 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Mon, 7 Jan 2013 20:11:53 +0000 (21:11 +0100)
r=dkl a=LpSolit

Bugzilla/DB/Schema.pm
Bugzilla/Install/DB.pm

index 7c3f9fa6ca1262528d6b53e8159c76ce50ed6f61..058e78a5f72dee966fbff6ae4e04c2cb317f9588 100644 (file)
@@ -400,7 +400,7 @@ use constant ABSTRACT_SCHEMA => {
             extra_data      => {TYPE => 'varchar(255)'}
         ],
         INDEXES => [
-            longdescs_bug_id_idx   => ['bug_id'],
+            longdescs_bug_id_idx   => [qw(bug_id work_time)],
             longdescs_who_idx     => [qw(who bug_id)],
             longdescs_bug_when_idx => ['bug_when'],
         ],
index e1a3f3630591f5ea02f2e49756b8bfb8afe71350..cb7276fb92ddf28f77b813aa20b33286c91f0121 100644 (file)
@@ -705,6 +705,9 @@ sub update_table_definitions {
     # 2012-12-29 reed@reedloden.com - Bug 785283
     _add_password_salt_separator();
 
+    # 2013-01-02 LpSolit@gmail.com - Bug 824361
+    _fix_longdescs_indexes();
+
     ################################################################
     # New --TABLE-- changes should go *** A B O V E *** this point #
     ################################################################
@@ -3734,6 +3737,15 @@ sub _fix_longdescs_primary_key {
     }
 }
 
+sub _fix_longdescs_indexes {
+    my $dbh = Bugzilla->dbh;
+    my $bug_id_idx = $dbh->bz_index_info('longdescs', 'longdescs_bug_id_idx');
+    if ($bug_id_idx && scalar @{$bug_id_idx->{'FIELDS'}} < 2) {
+        $dbh->bz_drop_index('longdescs', 'longdescs_bug_id_idx');
+        $dbh->bz_add_index('longdescs', 'longdescs_bug_id_idx', [qw(bug_id work_time)]);
+    }
+}
+
 sub _fix_dependencies_dupes {
     my $dbh = Bugzilla->dbh;
     my $blocked_idx = $dbh->bz_index_info('dependencies', 'dependencies_blocked_idx');