[Rt-commit] rt branch, 4.2/faster-database-size-estimates, created. rt-4.1.6-276-g1313d3d
Thomas Sibley
trs at bestpractical.com
Wed Feb 20 15:21:39 EST 2013
The branch, 4.2/faster-database-size-estimates has been created
at 1313d3d09cbeb8e067417cb1eb8e490b3a50aeba (commit)
- Log -----------------------------------------------------------------
commit 1313d3d09cbeb8e067417cb1eb8e490b3a50aeba
Author: Thomas Sibley <trs at bestpractical.com>
Date: Wed Feb 20 12:16:17 2013 -0800
Estimate RT size much more quickly by calculating id ranges
Counting tickets, transactions, and groups can take quite a long time on
very large databases. Reduce our fully accurate count to a pretty good
estimate by calculating the range of id values instead. The min and max
functions can use the primary key indexes to return quick results.
Using the range accounts for instances where the starting ticket ID was
bumped higher for aesthetic or recovery reasons. It will overestimate
size if there are significant gaps in the id sequence, however.
diff --git a/share/html/Admin/Tools/Configuration.html b/share/html/Admin/Tools/Configuration.html
index d723d88..dea1d29 100644
--- a/share/html/Admin/Tools/Configuration.html
+++ b/share/html/Admin/Tools/Configuration.html
@@ -157,7 +157,13 @@ for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers Unprivileged
} elsif ($type =~ /UnprivilegedUsers/) {
$count = $user_count - $privileged_count;
} else {
- $count = $collection->CountAll;
+ my $range = $collection->Column( FIELD => "id", FUNCTION => "max(?) - min(?)" );
+ my $result = $collection->First;
+ if ($result) {
+ $count = loc("[_1] (id range)", $result->__Value($range));
+ } else {
+ $count = loc("error calculating the range");
+ }
}
$index_size++;
</%PERL>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list