MuhammadTahaNaveed commented on issue #2137: URL: https://github.com/apache/age/issues/2137#issuecomment-2512741123
@pritish-moharir You have to create index on the expression used by age to access a certain property. ``` issue_2137=# SELECT * FROM cypher('test', $$EXPLAIN (costs off) MATCH (n1:NodeType1) WHERE n1.name = 'node1' RETURN n1 $$) AS (result agtype); QUERY PLAN ------------------------------------------------------------------------------------------------------ Seq Scan on "NodeType1" n1 Filter: (agtype_access_operator(VARIADIC ARRAY[properties, '"name"'::agtype]) = '"node1"'::agtype) (2 rows) ``` ``` issue_2137=# CREATE INDEX idx_btree_name ON test."NodeType1" USING btree (agtype_access_operator(VARIADIC ARRAY[properties, '"name"'::agtype])); CREATE INDEX ``` ``` issue_2137=# SELECT * FROM cypher('test', $$EXPLAIN (costs off) MATCH (n1:NodeType1) WHERE n1.name = 'node1' RETURN n1 $$) AS (result agtype); QUERY PLAN ---------------------------------------------------------------------------------------------------------- Index Scan using idx_btree_name on "NodeType1" n1 Index Cond: (agtype_access_operator(VARIADIC ARRAY[properties, '"name"'::agtype]) = '"node1"'::agtype) (2 rows) ``` If you want to utilize gin index, you need to use the filter like `MATCH (n {att1: 'value1'})`, since containment operator in where clause is not supported as of now. Below is an example: ``` issue_2137=# CREATE INDEX idx_gin ON test."NodeType1" USING gin (properties); CREATE INDEX ``` ``` issue_2137=# SELECT * FROM cypher('test', $$EXPLAIN (costs off) MATCH (n1:NodeType1 {name: "Node1"}) RETURN n1 $$) AS (result agtype); QUERY PLAN ----------------------------------------------------------------- Bitmap Heap Scan on "NodeType1" n1 Recheck Cond: (properties @> '{"name": "Node1"}'::agtype) -> Bitmap Index Scan on idx_gin Index Cond: (properties @> '{"name": "Node1"}'::agtype) (4 rows) ``` I hope this helps. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@age.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org