Version: v2.0.11+incompatible Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 12 Imported by: 0



BenchDB is a command line tool to test the performance of TiDB.

Quick Start

Make sure you have started PD and TiKV, then run:

./benchdb -run="create|truncate|insert:0_10000|update-random:0_10000:100000|select:0_10000:10"



The run argument defines the workflow of the test. You can define multiple jobs, separated by |. The jobs are executed sequentially. The run argument has the following options:

  • create creates a table. Currently it's just a typical simple table, with a few columns.

  • truncate truncates the table.

  • insert:xxx_yyy inserts rows with ID in [xxx, yyy). e.g. insert:0_10000 inserts 10000 rows with ID in range [0, 9999).

  • update-random:xxx_yyy:zzz updates a row with a random ID in range [xxx, yyy), for zzz times. e.g. update-random:100_200:50 updates 50 random rows with ID in range [100, 200).

  • update-range:xxx_yyy:zzz update a range of rows with ID in range [xxx, yyy), for zzz times.

  • select:xxx_yyy:zzz select rows with ID range in [xxx, yyy), for zzz times.

  • gc does a manually triggered GC, so we can compare the performance before and after GC.

  • query:xxx:zzz run a sql query xxx, for zzz times.

The output shows the execution time.


The name of the table, so we can create many tables for different tests without the need to clean up. Default is bench_db.


The blob column size in bytes, so we can test performance for different row size. Default is 1000.


The batch number of statements in a transaction, used for insert and update-random only, to speed up the test workflow. Default is 100.


The PD address. Default is


The log level. Default is warn.


The Go Gopher

There is no documentation for this package.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL