Files
greptimedb/tests/cases/standalone/common/create/create_database_opts.result
dennis zhuang 052033d436 feat: supports more db options (#6529)
* feat: supports more db options

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: tests

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: use btree map for consistent results

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* feat: adds compaction keys into valid db options

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2025-07-25 08:31:11 +00:00

196 lines
6.1 KiB
Plaintext

CREATE DATABASE mydb WITH (ttl = '1h');
Affected Rows: 1
SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| greptime_private |
| information_schema |
| mydb |
| public |
+--------------------+
SHOW FULL DATABASES;
+--------------------+------------+
| Database | Options |
+--------------------+------------+
| greptime_private | |
| information_schema | |
| mydb | 'ttl'='1h' |
| | |
| public | |
+--------------------+------------+
SHOW CREATE DATABASE mydb;
+----------+------------------------------------+
| Database | Create Database |
+----------+------------------------------------+
| mydb | CREATE DATABASE IF NOT EXISTS mydb |
| | WITH( |
| | ttl = '1h' |
| | ) |
+----------+------------------------------------+
USE mydb;
Affected Rows: 0
CREATE TABLE test(host STRING, cpu DOUBLE, ts TIMESTAMP TIME INDEX);
Affected Rows: 0
SHOW CREATE TABLE test;
+-------+-------------------------------------+
| Table | Create Table |
+-------+-------------------------------------+
| test | CREATE TABLE IF NOT EXISTS "test" ( |
| | "host" STRING NULL, |
| | "cpu" DOUBLE NULL, |
| | "ts" TIMESTAMP(3) NOT NULL, |
| | TIME INDEX ("ts") |
| | ) |
| | |
| | ENGINE=mito |
| | WITH( |
| | ttl = '1h' |
| | ) |
+-------+-------------------------------------+
USE public;
Affected Rows: 0
DROP DATABASE mydb;
Affected Rows: 0
---test more options----
CREATE DATABASE mydb WITH (
ttl = '1h',
'memtable.type'='partition_tree',
'append_mode'='false',
'merge_mode'='last_non_null',
'compaction.type' = 'twcs',
'compaction.twcs.time_window' = '1h',
'skip_wal'='true');
Affected Rows: 1
use mydb;
Affected Rows: 0
SHOW FULL DATABASES;
+--------------------+------------------------------------+
| Database | Options |
+--------------------+------------------------------------+
| greptime_private | |
| information_schema | |
| mydb | 'ttl'='1h' |
| | 'append_mode'='false' |
| | 'compaction.twcs.time_window'='1h' |
| | 'compaction.type'='twcs' |
| | 'memtable.type'='partition_tree' |
| | 'merge_mode'='last_non_null' |
| | 'skip_wal'='true' |
| | |
| public | |
+--------------------+------------------------------------+
CREATE TABLE test1(host STRING, cpu DOUBLE, ts TIMESTAMP TIME INDEX);
Affected Rows: 0
SHOW CREATE TABLE test1;
+-------+-----------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------+
| test1 | CREATE TABLE IF NOT EXISTS "test1" ( |
| | "host" STRING NULL, |
| | "cpu" DOUBLE NULL, |
| | "ts" TIMESTAMP(3) NOT NULL, |
| | TIME INDEX ("ts") |
| | ) |
| | |
| | ENGINE=mito |
| | WITH( |
| | append_mode = 'false', |
| | 'compaction.twcs.time_window' = '1h', |
| | 'compaction.type' = 'twcs', |
| | 'memtable.type' = 'partition_tree', |
| | merge_mode = 'last_non_null', |
| | skip_wal = 'true', |
| | ttl = '1h' |
| | ) |
+-------+-----------------------------------------+
CREATE TABLE test2(host STRING, cpu DOUBLE, ts TIMESTAMP TIME INDEX) WITH (
'append_mode'='true',
'merge_mode'='',
'skip_wal'='false');
Affected Rows: 0
SHOW CREATE TABLE test2;
+-------+-----------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------+
| test2 | CREATE TABLE IF NOT EXISTS "test2" ( |
| | "host" STRING NULL, |
| | "cpu" DOUBLE NULL, |
| | "ts" TIMESTAMP(3) NOT NULL, |
| | TIME INDEX ("ts") |
| | ) |
| | |
| | ENGINE=mito |
| | WITH( |
| | append_mode = 'true', |
| | 'compaction.twcs.time_window' = '1h', |
| | 'compaction.type' = 'twcs', |
| | 'memtable.type' = 'partition_tree', |
| | merge_mode = '', |
| | skip_wal = 'false', |
| | ttl = '1h' |
| | ) |
+-------+-----------------------------------------+
INSERT INTO test2 VALUES('host1', 1.0, '2023-10-01 00:00:00');
Affected Rows: 1
SELECT * FROM test2;
+-------+-----+---------------------+
| host | cpu | ts |
+-------+-----+---------------------+
| host1 | 1.0 | 2023-10-01T00:00:00 |
+-------+-----+---------------------+
USE public;
Affected Rows: 0
DROP DATABASE mydb;
Affected Rows: 0
SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| greptime_private |
| information_schema |
| public |
+--------------------+