Random Query Generator

The tool is capable of executing test scenarios that include:

  • Generate a database from a description of the desired data contents and properties;
  • Execute random queries based on SQL templates the queries must conform to;
  • Compare the results returned by different server versions, configurations, or storage engines;
  • Monitor the server during the test and detect deadlocks, crashes, replication failures and other interesting events.

How to install

In this article we describe installing and launching for Ubuntu / Linux generic; see detailed information here:

From Launchpad using Bazaar:
$ bzr branch lp:randgen

perl -MCPAN -e 'install DBD::mysql'

To invoke a shell
sudo perl -MCPAN -e "shell"
and install the various modules


For your first test run the commands from
All commands must to successful complete.

The following perl scripts are in the directory randgen:

– which generates the many different ways (read ‘trials’) in which RQG is started (using with various options to mysqld etc.
– which starts/stops mysqld, does various high-level checking etc. (in other words; ‘a basic RQG run’)
– which is the executor component (iow ‘the actual basic RQG test’)
– which setups the data (tables + data)


perl --dsn=dbi:mysql:host= --gendata=conf/examples/example.zz --grammar=conf/examples/example.yy
  1. 2016-08-10T14:16:19 Test completed successfully.

2. script generates SQL statements based on a grammar and dumps them to stdout where they can be saved to a file or forwarded to a mysql client for execution. All diagnostic messages by the RQG are prefixed with a # sign and therefore appear as comments in the query stream and will be ignored.

perl --grammar=ex_dt.yy --queries=10 --dsn=dbi:mysql:host=

INSERT INTO `table100_key_pk_parts_2_int_autoinc`(`col_set_utf8_not_null`) VALUES (999-00-00 00:00:-10);

Script successful completes.