1

您好我有一个 InnoDB 有一个支持事务的默认数据库。但是当我为 Mysql sql-benchmarking 运行事务脚本时,出现以下错误:

Testing server 'MySQL 5.5.29 0ubuntu0.12.10.1' at 2013-02-11 11:32:28

Test skipped because the database doesn't support transactions

展示引擎;

+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+

我编辑了 my.cnf 添加了默认引擎 Innodb。但仍然没有运气。

perl 脚本是 Mysql Sql bench 中的“test-transaction”...

###
### Test insert perfomance
###

test_insert("bench1","insert_commit",0);
test_insert("bench2","insert_autocommit",1);

sub test_insert
{
  my ($table, $test_name, $auto_commit)= @_;
  my ($loop_time,$end_time,$id,$rev_id,$grp,$region);

  $dbh->{AutoCommit}= $auto_commit;
  $loop_time=new Benchmark;

  for ($id=0,$rev_id=$opt_loop_count-1 ; $id < $opt_loop_count ;
       $id++,$rev_id--)
  {
    $grp=$id/$opt_groups;
    $region=chr(65+$id%$opt_groups);
    do_query($dbh,"insert into $table values ($id,$rev_id,'$region',$grp,0)");
  }

  $dbh->commit if (!$auto_commit);
  $end_time=new Benchmark;
  print "Time for $test_name  ($opt_loop_count): " .
    timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
4

0 回答 0