mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-18 05:50:41 +00:00
36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
CREATE TABLE monitor ( host STRING, ts TIMESTAMP, cpu DOUBLE DEFAULT 0, memory DOUBLE, TIME INDEX (ts), PRIMARY KEY(host)) ;
|
|
|
|
Affected Rows: 0
|
|
|
|
insert into monitor(host, cpu, memory, ts) values ('host1', 66.6, 1024, 1655276557000), ('host2', 77.7, 2048, 1655276558000), ('host3', 88.8, 3072, 1655276559000);
|
|
|
|
Affected Rows: 3
|
|
|
|
select * from monitor;
|
|
|
|
+-------+---------------------+------+--------+
|
|
| host | ts | cpu | memory |
|
|
+-------+---------------------+------+--------+
|
|
| host1 | 2022-06-15T07:02:37 | 66.6 | 1024.0 |
|
|
| host2 | 2022-06-15T07:02:38 | 77.7 | 2048.0 |
|
|
| host3 | 2022-06-15T07:02:39 | 88.8 | 3072.0 |
|
|
+-------+---------------------+------+--------+
|
|
|
|
delete from monitor where host = 'host1' and ts = 1655276557000;
|
|
|
|
Affected Rows: 1
|
|
|
|
select * from monitor;
|
|
|
|
+-------+---------------------+------+--------+
|
|
| host | ts | cpu | memory |
|
|
+-------+---------------------+------+--------+
|
|
| host2 | 2022-06-15T07:02:38 | 77.7 | 2048.0 |
|
|
| host3 | 2022-06-15T07:02:39 | 88.8 | 3072.0 |
|
|
+-------+---------------------+------+--------+
|
|
|
|
drop table monitor;
|
|
|
|
Affected Rows: 1
|
|
|