---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ydb.tech/docs/en/recipes/ydb-cli/benchmarks.md?version=v26.1
  - https://ydb.tech/docs/ru/recipes/ydb-cli/benchmarks.md?version=v26.1
  - href: en/recipes/ydb-cli/benchmarks.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
sourcePath: en/core/recipes/ydb-cli/benchmarks.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# Conducting load testing

YDB CLI has a built-in toolkit for performing load testing using standard benchmarks:

| Benchmark                            | Reference                                                |
|--------------------------------------|----------------------------------------------------------|
| [TPC-C](https://tpc.org/tpcc/)       | [tpcc](../../reference/ydb-cli/workload-tpcc.md) |
| [TPC-H](https://tpc.org/tpch/)       | [tpch](../../reference/ydb-cli/workload-tpch.md) |
| [TPC-DS](https://tpc.org/tpcds/)     | [tpcds](../../reference/ydb-cli/workload-tpcds.md) |
| [ClickBench](https://benchmark.clickhouse.com/) | [clickbench](../../reference/ydb-cli/workload-click-bench.md) |

Also, there is a possibility to run user-defined testing scenarios, which are initiated via the `ydb workload query` command, see the [description](https://ydb.tech/docs/en/reference/ydb-cli/workload-query.md?version=v26.1). The details are provided in the corresponding section.

All mentioned methods emulate the user's workload under the given scenarios. The detailed description of each method is provided in the corresponding sections, the links to which are provided above.

All commands for working with benchmarks are organized into corresponding groups, and the database path is specified in the same way for all commands:

```bash
ydb workload tpcc --path path/in/database ...
ydb workload tpch --path path/in/database ...
ydb workload tpcds --path path/in/database ...
ydb workload clickbench --path path/in/database ...
ydb workload query --path path/in/database ...
```

Load testing consists of three stages:

1. [Data preparation](#data-preparation)
1. [Testing](#testing)
1. [Cleanup](#cleanup)

## Data preparation {#data-preparation}

It consists of two steps: initializing tables and filling them with data.

### Initialization

Initialization is performed by the `init` command:

```bash
ydb workload tpcc --path tpcc/10wh init
ydb workload clickbench --path clickbench/hits init --store=row
ydb workload tpch --path tpch/s1 init --store=column
ydb workload tpcds --path tpcds/s1 init --store=external-s3
ydb workload query --path user/suite1 init --suite-path /home/user/user_suite
```

At the stage of creating tables, for `tpch`, `tpcds`, and `clickbench`, you can configure the tables to be created:

* Select the type of tables to be used: row, column, external, etc. (parameter `--store`);
* Select the types of columns to be used: some data types from the original benchmarks can be represented by multiple YDB data types. In such cases, it is possible to select a specific one with `--string`, `--datetime`, and `--float-mode` parameters.

You can also specify that tables should be deleted before creation if they already exist using the `--clear` parameter.

For more details, see the relevant reference sections:

* [tpcc init](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpcc.md?version=v26.1#init)
* [clickbench init](https://ydb.tech/docs/en/reference/ydb-cli/workload-click-bench.md?version=v26.1#init)
* [tpch init](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpch.md?version=v26.1#init)
* [tpcds init](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpcds.md?version=v26.1#init)
* [query init](https://ydb.tech/docs/en/reference/ydb-cli/workload-query.md?version=v26.1#init)

### Loading data into the tables

The `import` command is used to load data into the benchmark tables. This command is specific to each benchmark, and its behavior depends on the subcommands. However, there are also parameters common to all benchmarks.

For more details, see the relevant reference sections:

* [tpcc import](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpcc.md?version=v26.1#load)
* [tpch import](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpch.md?version=v26.1#load)
* [tpcds import](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpcds.md?version=v26.1#load)
* [clickbench import](https://ydb.tech/docs/en/reference/ydb-cli/workload-click-bench.md?version=v26.1#load)

Examples:

```bash
ydb workload tpcc --path tpcc/10wh import
ydb workload clickbench --path clickbench/hits import files --input hits.csv.gz
ydb workload tpch --path tpch/s1 import generator --scale 1
ydb workload tpcds --path tpcds/s1 import generator --scale 1
ydb workload query --path user/suite1 import --suite-path /home/user/user_suite
```

## Testing {#testing}

The performance testing is performed using the `run` command. Its behavior is mostly the same across different benchmarks, though some differences do exist.

Examples:

```bash
ydb workload tpcc --path tpcc/10wh run
ydb workload clickbench --path clickbench/hits run --include 1-5,8
ydb workload tpch --path tpch/s1 run --exсlude 3,4 --iterations 3
ydb workload tpcds --path tpcds/s1 run --plan ~/query_plan --include 2 --iterations 5
ydb workload query --path user/suite1 run --plan ~/query_plan --include first_query_set.1.sql,second_query_set.2.sql --iterations 5
```

The command 'run' for each benchmark has a number of additional parameters for configuring the types of reports generated, collecting statistics, and other results of load testing.

For more details, see the relevant reference sections:

* [tpcc run](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpcc.md?version=v26.1#run)
* [clickbench run](https://ydb.tech/docs/en/reference/ydb-cli/workload-click-bench.md?version=v26.1#run)
* [tpch run](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpch.md?version=v26.1#run)
* [tpcds run](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpcds.md?version=v26.1#run)
* [query run](https://ydb.tech/docs/en/reference/ydb-cli/workload-query.md?version=v26.1#run)

## Cleanup {#cleanup}

After all necessary testing has been completed, the benchmark's data can be removed from the database using the `clean` command:

```bash
ydb workload tpcc --path tpcc/10wh clean
ydb workload clickbench --path clickbench/hits clean
ydb workload tpch --path tpch/s1 clean
ydb workload tpcds --path tpcds/s1 clean
ydb workload query --path user/suite1 clean
```

For more details, see the relevant reference sections:

* [tpcc clean](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpcc.md?version=v26.1#cleanup)
* [clickbench clean](https://ydb.tech/docs/en/reference/ydb-cli/workload-click-bench.md?version=v26.1#cleanup)
* [tpch clean](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpch.md?version=v26.1#cleanup)
* [tpcds clean](https://ydb.tech/docs/en/reference/ydb-cli/workload-tpcds.md?version=v26.1#cleanup)
* [query clean](https://ydb.tech/docs/en/reference/ydb-cli/workload-query.md?version=v26.1#cleanup)
