summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-09-05 01:17:04 +0200
committermkanat%bugzilla.org <>2006-09-05 01:17:04 +0200
commit0436b3d474c2562854e5ae727821dc77f63bd79a (patch)
treea6737088eab918aa0d9e8f57a1f05a956dc667ab /Bugzilla/Install
parentfbe550dd6a5783e8ebfaa0efb8e138ecc563a1cb (diff)
downloadbugzilla-0436b3d474c2562854e5ae727821dc77f63bd79a.tar.gz
bugzilla-0436b3d474c2562854e5ae727821dc77f63bd79a.tar.xz
Bug 57350: "added comments" search is slow or doesn't work at all
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=bkor, a=myk
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r--Bugzilla/Install/DB.pm21
1 files changed, 15 insertions, 6 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 7887d9844..ccbb5f8cd 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -218,12 +218,6 @@ sub update_table_definitions {
_recrypt_plaintext_passwords();
- # 2001-06-06 justdave@syndicomm.com:
- # There was no index on the 'who' column in the long descriptions table.
- # This caused queries by who posted comments to take a LONG time.
- # http://bugzilla.mozilla.org/show_bug.cgi?id=57350
- $dbh->bz_add_index('longdescs', 'longdescs_who_idx', [qw(who)]);
-
# 2001-06-15 kiko@async.com.br - Change bug:version size to avoid
# truncates re http://bugzilla.mozilla.org/show_bug.cgi?id=9352
$dbh->bz_alter_column('bugs', 'version',
@@ -489,6 +483,8 @@ sub update_table_definitions {
$dbh->bz_alter_column('profiles', 'realname',
{TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"});
+ _update_longdescs_who_index();
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -2695,6 +2691,19 @@ EOT
}
}
+sub _update_longdescs_who_index {
+ my $dbh = Bugzilla->dbh;
+ # When doing a search on who posted a comment, longdescs is joined
+ # against the bugs table. So we need an index on both of these,
+ # not just on "who".
+ my $who_index = $dbh->bz_index_info('longdescs', 'longdescs_who_idx');
+ if (!$who_index || scalar @{$who_index->{FIELDS}} == 1) {
+ # If the index doesn't exist, this will harmlessly do nothing.
+ $dbh->bz_drop_index('longdescs', 'longdescs_who_idx');
+ $dbh->bz_add_index('longdescs', 'longdescs_who_idx', [qw(who bug_id)]);
+ }
+}
+
1;
__END__