diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-07-10 07:15:39 +0200 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-07-10 07:15:39 +0200 |
commit | 657f495a00653f32a6be0d6c532b8f53dbf09ed6 (patch) | |
tree | 651395854697e9d531132dd226bd7949b4f1c547 /Bugzilla | |
parent | 8bdb86fdce8ad3b177a81f3cf07bf026e2faa0e2 (diff) | |
download | bugzilla-657f495a00653f32a6be0d6c532b8f53dbf09ed6.tar.gz bugzilla-657f495a00653f32a6be0d6c532b8f53dbf09ed6.tar.xz |
Bug 577754: Make updating bugs_fulltext during checksetup.pl WAY faster
for MySQL.
r=mkanat, a=mkanat (module owner)
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Install/DB.pm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index d9a36b75b..26e36f7df 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -3182,12 +3182,21 @@ sub _populate_bugs_fulltext { return if !@$bug_ids; my $num_bugs = scalar @$bug_ids; + my $command = "INSERT"; my $where = ""; if ($fulltext) { print "Updating bugs_fulltext for $num_bugs bugs...\n"; $where = "WHERE " . $dbh->sql_in('bugs.bug_id', $bug_ids); - $dbh->do("DELETE FROM bugs_fulltext WHERE " - . $dbh->sql_in('bug_id', $bug_ids)); + # It turns out that doing a REPLACE INTO is up to 10x faster + # than any other possible method of updating the table, in MySQL, + # which matters a LOT for large installations. + if ($dbh->isa('Bugzilla::DB::Mysql')) { + $command = "REPLACE"; + } + else { + $dbh->do("DELETE FROM bugs_fulltext WHERE " + . $dbh->sql_in('bug_id', $bug_ids)); + } } else { print "Populating bugs_fulltext with $num_bugs entries..."; @@ -3195,7 +3204,7 @@ sub _populate_bugs_fulltext { } my $newline = $dbh->quote("\n"); $dbh->do( - q{INSERT INTO bugs_fulltext (bug_id, short_desc, comments, + qq{$command INTO bugs_fulltext (bug_id, short_desc, comments, comments_noprivate) SELECT bugs.bug_id, bugs.short_desc, } . $dbh->sql_group_concat('longdescs.thetext', $newline, 0) |