首页 > 解决方案 > 如何在 AgensGraph 上更快地获取标签的最大位置 ID?

问题描述

我想获得标签的最大位置 ID。

但是,跟踪查询非常慢。

agens=# match (n:v) return max(graphid_locid(id(n)));
 max 
-----
 6
(1 row)

如何在 AgensGraph 上更快地获取标签的最大位置 ID?

标签: agens-graph

解决方案


从 pg_sequences 表中获取相关的序列值。

agens=# select start_value from pg_sequences where schemaname = 'graph' and sequencename = 'v_id_seq';
 start_value 
-------------
           6
(1 row)

推荐阅读