- 语句 1
- 场景:如何进行数据统计,分别用 LOOKUP、MATCH 和 SHOW STATS
- 具体语句:以统计某条边为例子,记得 MATCH 需要创建索引,如果是导入数据后创建的索引,记得进行 REBUILD INDEX 操作。
# LOOKUP lookup on edge_name yield edge as e | yield count(*) # MATCH match (m) - [e:edge_name] - (n) return count(e) # SHOW STATS 看文档:https://docs.nebula-graph.com.cn/3.4.1/3.ngql-guide/7.general-query-statements/6.show/14.show-stats/
- 适合版本:v3.2.0
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/11653
- 语句 2
- 场景:如何根据点 id 查看某个 tag 是否存在
- 具体语句:
match (v:tagName) where id(v)==‘123A123’ return v.tagName.prop1
- 适合版本:v3.2.0
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/11653
- 语句 3
- 场景:根据属性删除对应边
- 具体语句:
Lookup on `in_user` where in_user.user_type == 2 yield src(edge) as src, dst(edge) as dst | delete edge `in_user` $-.src->$-.dst
- 适合版本:v3.2.1
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/11578
- 语句 4
- 场景:删除没有边的点
- 具体语句:
lookup on player yield id(vertex) as vid minus (lookup on player yield id(vertex) as vid | go 1 step from $-.vid over * bidirect yield distinct id($^) as vid) ) | delete vertex $-.vid
- 适合版本:v3.1.0
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/11609
1 个赞