ClickHouse/docs/en/engines/table-engines/integrations/embedded-rocksdb.md

43 lines
1.2 KiB
Markdown
Raw Normal View History

2021-01-25 14:13:29 +00:00
---
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
## 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.
2021-01-22 16:40:58 +00:00
- `primary key` must be specified, it supports only one column in the primary key. The primary key will be serialized in binary as a `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`.
2020-10-01 10:59:51 +00:00
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
2021-01-26 19:24:06 +00:00
```
[Original article](https://clickhouse.tech/docs/en/operations/table_engines/embedded-rocksdb/) <!--hide-->