如何在AgensGraph上创建索引?

当遍历顶点或egde时,它非常慢 .

我想创建加速速度的索引 .

# match (n:v{id:1}) return n;
        n        
-----------------
 v[3.1]{"id": 1}
(1 row)

Time: 693.100 ms

如何为顶点或边创建索引?

回答(1)

2 years ago

对图形对象的create index使用“CREATE PROPERTY INDEX”语句 .

# match (n:v{id:1}) return n;
        n        
-----------------
 v[3.1]{"id": 1}
(1 row)

Time: 693.100 ms
# create property index on v ( id );
CREATE PROPERTY INDEX
Time: 2227.147 ms
# match (n:v{id:1}) return n;
        n        
-----------------
 v[3.1]{"id": 1}
(1 row)

Time: 5.935 ms

在这种情况下,加速超过百倍 .