14promdb.mql 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. -- ============================================================
  2. -- bucket promdb 测试
  3. -- ============================================================
  4. -- 1. 插入数据到 promdb
  5. insert into /test/aaa/test_bucket_promdb (name, metric, ts) values ('prom_001', 1.5, 1700000000000)
  6. ;
  7. insert into /test/aaa/test_bucket_promdb (name, metric, ts) values ('prom_002', 2.5, 1700000001000)
  8. ;
  9. insert into /test/aaa/test_bucket_promdb (name, metric, ts) values ('prom_003', 3.5, 1700000002000)
  10. ;
  11. -- 2. 查询 promdb
  12. select * from /test/aaa/test_bucket_promdb where name='prom_001'
  13. /**
  14. output()
  15. count(1)
  16. **/
  17. ;
  18. -- 3. 全表查询
  19. select name, metric, ts from /test/aaa/test_bucket_promdb
  20. /**
  21. output()
  22. **/
  23. ;
  24. -- 4. 更新 promdb
  25. update /test/aaa/test_bucket_promdb set metric=10.5 where name='prom_001'
  26. ;
  27. select name, metric from /test/aaa/test_bucket_promdb where name='prom_001'
  28. /**
  29. output()
  30. match("metric","10.5")
  31. **/
  32. ;
  33. -- 5. 聚合 promdb
  34. select count(*) from /test/aaa/test_bucket_promdb
  35. /**
  36. output()
  37. **/
  38. ;
  39. -- 6. delete promdb
  40. delete from /test/aaa/test_bucket_promdb where name='prom_003'
  41. ;
  42. select count(*) from /test/aaa/test_bucket_promdb
  43. /**
  44. output()
  45. **/
  46. ;