print "Big select takes ", scalar(time) - $begin, "secs for $ret->[0] records\n";
print STDERR
"new|$ret->[0]|$nb|", (scalar(time) - $begin),"\n";
+ print "Doing Accurate query...\n";
+ }
+ foreach my $i (1..4) {
+ my $begin = time;
+ my $ret = $dbh->selectrow_arrayref("SELECT count(1) from (
+SELECT Path.Path, Filename.Name, Temp.FileIndex, Temp.JobId, LStat, MD5
+FROM (
+ SELECT FileId, Job.JobId AS JobId, FileIndex, File.PathId AS PathId,
+ File.FilenameId AS FilenameId, LStat, MD5
+ FROM Job, File,
+ ( SELECT MAX(JobTDate) AS JobTDate, PathId, FilenameId
+ FROM File JOIN Job USING (JobId) WHERE File.JobId IN ($jobid)
+ GROUP BY PathId, FilenameId
+ ) AS T1
+ WHERE Job.JobId IN ($jobid)
+ AND T1.JobTDate = Job.JobTDate
+ AND Job.JobId = File.JobId
+ AND T1.PathId = File.PathId
+ AND T1.FilenameId = File.FilenameId
+ ) AS Temp
+ JOIN Filename ON (Filename.FilenameId = Temp.FilenameId)
+ JOIN Path ON (Path.PathId = Temp.PathId)
+WHERE FileIndex > 0 ORDER BY Temp.JobId, FileIndex ASC
+) as a") or die "Can't do query $DBI::errstr";
+
+ print "Big select without base takes ", scalar(time) - $begin, "secs for $ret->[0] records\n";
+ print STDERR
+ "base|$ret->[0]|$nb|", (scalar(time) - $begin),"\n";
}
if (0) {
foreach my $i (1..4) {