Skip to main content

GenerateRandom Table Engine

The GenerateRandom table engine produces random data for given table schema.

Usage examples:

  • Use in test to populate reproducible large table.
  • Generate random input for fuzzing tests.

Usage in ClickHouse Server​

ENGINE = GenerateRandom(random_seed, max_string_length, max_array_length)

The max_array_length and max_string_length parameters specify maximum length of all array columns and strings correspondingly in generated data.

Generate table engine supports only SELECT queries.

It supports all DataTypes that can be stored in a table except LowCardinality and AggregateFunction.


1. Set up the generate_engine_table table:

CREATE TABLE generate_engine_table (name String, value UInt32) ENGINE = GenerateRandom(1, 5, 3)

2. Query the data:

SELECT * FROM generate_engine_table LIMIT 3
β”‚ c4xJ β”‚ 1412771199 β”‚
β”‚ r β”‚ 1791099446 β”‚
β”‚ 7#$ β”‚ 124312908 β”‚

Details of Implementation​

  • Not supported:
    • ALTER
    • INSERT
    • Indices
    • Replication

Original article