if ($opt_small_test)
{
$opt_loop_count/=10;
$opt_medium_loop_count/=10;
$opt_small_loop_count/=10;
}
print "Testing table elimination feature\n";
print "The test table has $opt_loop_count rows.\n\n";
# A query to get the recent versions of all attributes:
$select_current_full_facts="
select
F.id, A1.attr1, A2.attr2
from
elim_facts F
left join elim_attr1 A1 on A1.id=F.id
left join elim_attr2 A2 on A2.id=F.id and
A2.fromdate=(select MAX(fromdate) from
elim_attr2 where id=A2.id); "; # TODO: same as above but for some given date also?
#### #### Fill attr2 table #### if ($opt_fast && $server->{transactions})
{
$dbh->{AutoCommit} = 0;
}
print "Inserting $n_facts rows into attr2 table\n";
$loop_time=new Benchmark;
for ($id=0; $id < $n_facts ; $id++)
{ # Two values for each $id - current one and obsolete one.
$attr1= ceil(rand($n_facts));
$query="insert into elim_attr2 values ($id, $attr1, now())";
do_query($dbh,$query);
$query="insert into elim_attr2 values ($id, $attr1, '2009-01-01')";
do_query($dbh,$query);
}
if ($opt_fast && $server->{transactions})
{
$dbh->commit;
$dbh->{AutoCommit} = 1;
}
### ### Now with elimination: select only only one fact ###
print "testing selection of one attribute\n";
$loop_time=new Benchmark;
$rows=0; for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
$val= rand($n_facts);
$rows+=fetch_all_rows($dbh,"select id, attr1 from elim_current_facts where id=$val");
}
$count=$i;
### ### Now with elimination: select only only one fact ###
print "testing selection of one attribute\n";
$loop_time=new Benchmark;
$rows=0; for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
$val= rand($n_facts);
$rows+=fetch_all_rows($dbh,"select id, attr2 from elim_current_facts where id=$val");
}
$count=$i;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.