mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-19 14:30:43 +00:00
* test: test create table with database ttl * feat: show database options * fix: comment * chore: apply suggestion Co-authored-by: Jeremyhi <jiachun_feng@proton.me> * chore: fix CR comments and refactor * chore: style Co-authored-by: Weny Xu <wenymedia@gmail.com> --------- Co-authored-by: Jeremyhi <jiachun_feng@proton.me> Co-authored-by: Weny Xu <wenymedia@gmail.com>
71 lines
1.6 KiB
Plaintext
71 lines
1.6 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 | |
|
|
+--------------------+----------+
|
|
|
|
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
|
|
|
|
SHOW DATABASES;
|
|
|
|
+--------------------+
|
|
| Database |
|
|
+--------------------+
|
|
| greptime_private |
|
|
| information_schema |
|
|
| public |
|
|
+--------------------+
|
|
|