]> git.koha-community.org Git - koha.git/blob - marc/benchmarks/getdata-steve
Benchmarking files for comparing performance of two different proposed database
[koha.git] / marc / benchmarks / getdata-steve
1 #!/usr/bin/perl
2 #
3 #
4 # Benchmark script for Steve's marc db schema
5
6
7 use DBI;
8
9
10 my $dbh=DBI->connect("dbi:mysql:kohabenchmark", 'root', 'testpass');
11
12 my $count=$ARGV[0];
13 my $print=$ARGV[1];
14 my $bibid=$ARGV[2];
15
16
17 for ($i=0; $i<$count; $i++) {
18     ($bibid) || ($bibid=int(rand(79998))+1);
19
20     ($print) && (print "BIBID: $bibid\n");
21     my $sth=$dbh->prepare("select tagid,tag,subfieldcode,subfieldvalue from marc_2XX_subfield_table where bibid=$bibid order by tagid,subfieldorder");
22     $sth->execute;
23     my $lasttag='';
24     while (my ($tagid,$tag,$subfieldcode,$subfieldvalue) = $sth->fetchrow) {
25         if ($tag ne $lasttag) {
26             ($print) && (print "  Tag: $tag\n");
27             $lasttag=$tag;
28         }
29         ($print) && (print "    $subfieldcode $subfieldvalue\n");
30     }
31     $bibid=0;
32 }