Bug #48932 Performance problem with gendata / Random.pm
Submitted: 20 Nov 2009 8:59
Reporter: Philip Stoev Email Updates:
Status: Verified Impact on me:
None 
Category:Tools: Random Query Generator Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Bernt Marius Johnsen CPU Architecture:Any

[20 Nov 2009 8:59] Philip Stoev
Description:
gendata.pl and Random.pm have performance issues. Generating a database with 260K values takes 95 seconds on a very fast machine, making perl take 90% of the CPU time v.s. mysqld's 10%. I think we can do better than that. Here is the performance profile:

Total Elapsed Time = 95.00593 Seconds
  User+System Time = 74.43593 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 46.6   34.69 86.349      1   34.692 86.348  GenTest::App::Gendata::run
 19.7   14.71 26.051 264000   0.0000 0.0000  GenTest::Random::fieldType
 16.0   11.92 11.920 264000   0.0000 0.0000  GenTest::Random::isFieldType
 13.0   9.743  9.743 579099   0.0000 0.0000  GenTest::Random::uint16
 8.57   6.380 11.469 264000   0.0000 0.0000  GenTest::Random::arrayElement
 7.38   5.491  8.276 158300   0.0000 0.0000  GenTest::Random::string
 1.68   1.253  1.253  11112   0.0001 0.0001  DBI::st::execute
 0.64   0.480  1.140 146629   0.0000 0.0000  GenTest::Random::date
 0.34   0.251  0.602 146489   0.0000 0.0000  GenTest::Random::time
 0.24   0.182  0.574  73122   0.0000 0.0000  GenTest::Random::timestamp
 0.23   0.173  0.173  11136   0.0000 0.0000  DBI::_new_handle
 0.21   0.153  0.153  11115   0.0000 0.0000  GenTest::new
 0.17   0.127  2.190  11112   0.0000 0.0002  GenTest::Executor::MySQL::execute
 0.17   0.123  0.123  11134   0.0000 0.0000  DBD::mysql::st::_prepare
 0.17   0.123  0.419 175686   0.0000 0.0000  GenTest::Random::digit

How to repeat:
perl -d:DProf gendata.pl --dsn=... --config=conf/partition_pruning.zz