Query Load Testing with CRDB

Andrew Deally
2 min readNov 9, 2022

Load testing is a common practice used across software releases. Not only for application code releases but also for database releases. There are various technologies which can provide an end to end solution for stress testing such as Jmeter, Locust and others in that space. A simpler approach for narrowing down to just the database would be to use a load generator for SQL for testing acceptance and regression to the database — a good example is surfacing query plan regressions. The following tool can be used with Cockroachdb.

Workload QueryBench

Querybench provides a subcommand from the workload binary to execute queries from a SQL file in order for each thread. Outside of the github project, the following is commands to get a stress test going.

And the directions are simple.

After loading a simple TPCH schema and building a SQL file, its as simple as executing with the following command

Querybench output

Here is the example SQL file

sample SQL file to be based to Querybench

An alternative approach is to break the queries into individual SQL files and launch them with different settings.

Now, we can use Querybench, to test changes in the workload, schema and monitor the impact of the changes over the same load scenarios.

--

--