88_memdb.mql 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. delete 性能备份AaB from /test/性能AaB_MemDB with version
  2. /**
  3. onerror(continue,`not exist`,`not find`,`not found`)
  4. **/
  5. ;
  6. delete 性能AaB from /test/性能AaB_MemDB with version
  7. /**
  8. onerror(continue,`not exist`,`not find`,`not found`)
  9. **/
  10. ;
  11. delete from /test/性能AaB_MemDB with version
  12. /**
  13. onerror(continue,`not exist`,`not find`,`not found`)
  14. sleep(3s)
  15. **/
  16. ;
  17. drop class if exists /test/性能AaB_MemDB;
  18. create class if not exists /test/性能AaB_MemDB (
  19. 主机AaB varchar,
  20. v_date date,
  21. v_timestamp timestamp,
  22. 性能备份AaB bucket {
  23. "dict": true,
  24. "slot": 5,
  25. "ttl": 2,
  26. "type": "promdb",
  27. "version": 1
  28. },
  29. noindex varchar,
  30. 性能AaB bucket {
  31. "dict": true,
  32. "slot": 5,
  33. "ttl": 2,
  34. "type": "promdb",
  35. "version": 1
  36. },
  37. keys(主机AaB),
  38. indexes(主机AaB,v_date,v_timestamp )
  39. )with core=memory, autosearch=true , version=false , key=manu, alias='性能测试' , nickname='性能AaB_MemDB'
  40. ;
  41. insert into /test/性能AaB_MemDB (id,主机AaB,v_date,v_timestamp) values ('性能AaB:test',"服务器1","2026-04-02","2026-04-02 15:55:55");
  42. select count(*) from /test/性能AaB_MemDB where 主机AaB='服务器1'
  43. /**
  44. output()
  45. count(1)
  46. **/
  47. ;
  48. cql: select * from field where namespace='test' and name in ('主机aab','noindex')
  49. /**
  50. match("name", "主机aab", "isindex", 1)
  51. match("name", "noindex", "isindex", 0)
  52. **/
  53. ;
  54. select * from /test/性能AaB_MemDB where v_date between '2026-04-02' and '2026-04-03' limit 10
  55. /**
  56. output()
  57. count(1)
  58. **/
  59. ;
  60. select * from /test/性能AaB_MemDB where v_date between 1774972800000 and 1776182400000 limit 10
  61. /**
  62. output()
  63. count(1)
  64. **/
  65. ;
  66. select * from /test/性能AaB_MemDB where v_timestamp between '2026-04-02 00:00:00.000' and '2026-04-03 00:00:00.000' limit 10
  67. /**
  68. output()
  69. count(1)
  70. **/
  71. ;
  72. select * from /test/性能AaB_MemDB where v_timestamp between 1774972800000 and 1776182400000 limit 10
  73. /**
  74. output()
  75. count(1)
  76. **/
  77. ;
  78. -- native sql 日期类型保存为 毫秒数
  79. {"sql":"select * from /test/性能AaB_MemDB where v_date between 1774972800000 and 1776182400000 limit 10"}
  80. /**
  81. output()
  82. count(1)
  83. **/
  84. ;
  85. {"sql":"select \"order\".id from /test/性能AaB_MemDB \"order\" where \"order\".v_date between 1774972800000 and 1776182400000 limit 10"}
  86. /**
  87. output()
  88. count(1)
  89. **/
  90. ;
  91. -- native sql 时间戳类型保存为 毫秒数
  92. {"sql":"select * from /test/性能AaB_MemDB where v_timestamp between 1774972800000 and 1776182400000 limit 10"}
  93. /**
  94. output()
  95. count(1)
  96. **/
  97. ;