2020-10-01 10:59:51 +00:00
|
|
|
|
---
|
|
|
|
|
toc_priority: 6
|
2020-11-08 15:41:16 +00:00
|
|
|
|
toc_title: EmbeddedRocksDB
|
2020-10-01 10:59:51 +00:00
|
|
|
|
---
|
|
|
|
|
|
2020-11-08 15:41:16 +00:00
|
|
|
|
# EmbeddedRocksDB Engine {#EmbeddedRocksDB-engine}
|
2020-10-01 10:59:51 +00:00
|
|
|
|
|
|
|
|
|
This engine allows integrating ClickHouse with [rocksdb](http://rocksdb.org/).
|
|
|
|
|
|
2020-11-08 15:41:16 +00:00
|
|
|
|
`EmbeddedRocksDB` lets you:
|
2020-10-01 10:59:51 +00:00
|
|
|
|
|
2020-11-08 15:41:16 +00:00
|
|
|
|
## Creating a Table {#table_engine-EmbeddedRocksDB-creating-a-table}
|
2020-10-01 10:59:51 +00:00
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster]
|
|
|
|
|
(
|
|
|
|
|
name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1],
|
|
|
|
|
name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2],
|
|
|
|
|
...
|
2020-11-08 15:41:16 +00:00
|
|
|
|
) ENGINE = EmbeddedRocksDB PRIMARY KEY(primary_key_name)
|
2020-10-01 10:59:51 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Required parameters:
|
|
|
|
|
|
|
|
|
|
- `primary_key_name` – any column name in the column list.
|
|
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
CREATE TABLE test
|
|
|
|
|
(
|
|
|
|
|
`key` String,
|
|
|
|
|
`v1` UInt32,
|
|
|
|
|
`v2` String,
|
|
|
|
|
`v3` Float32,
|
|
|
|
|
)
|
2020-11-08 15:41:16 +00:00
|
|
|
|
ENGINE = EmbeddedRocksDB
|
2020-10-01 10:59:51 +00:00
|
|
|
|
PRIMARY KEY key
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Description {#description}
|
|
|
|
|
|
2020-11-08 15:35:22 +00:00
|
|
|
|
- `primary key` must be specified, it only supports one column in primary key. The primary key will serialized in binary as rocksdb key.
|
|
|
|
|
- columns other than the primary key will be serialized in binary as rocksdb value in corresponding order.
|
|
|
|
|
- queries with key `equals` or `in` filtering will be optimized to multi keys lookup from rocksdb.
|