MuhammadTahaNaveed commented on issue #2137:
URL: https://github.com/apache/age/issues/2137#issuecomment-2515053014

   @pritish-moharir You need to create index on id column of node label, and 
index on start_id and end_id of edge label. PR #2117 does that by default btw.
   
   ```
   issue_2137=# SELECT * FROM cypher('test', $$EXPLAIN (costs off) MATCH 
p=(:NodeType1)-[:RelType1_NodeType1]->(:NodeType2) 
   RETURN p
   $$) AS (result agtype);
                                     QUERY PLAN                                 
 
   
------------------------------------------------------------------------------
    Hash Join
      Hash Cond: (_age_default_alias_1.end_id = _age_default_alias_2.id)
      ->  Hash Join
            Hash Cond: (_age_default_alias_1.start_id = _age_default_alias_0.id)
            ->  Seq Scan on "RelType1_NodeType1" _age_default_alias_1
            ->  Hash
                  ->  Seq Scan on "NodeType1" _age_default_alias_0
      ->  Hash
            ->  Seq Scan on "NodeType2" _age_default_alias_2
   (9 rows)
   ```
   
   ```
   issue_2137=# CREATE UNIQUE INDEX idx_n1_id ON test."NodeType1" USING btree 
(id);
   CREATE INDEX
   issue_2137=# CREATE UNIQUE INDEX idx_n2_id ON test."NodeType2" USING btree 
(id);
   CREATE INDEX
   issue_2137=# CREATE INDEX idx_r1_id ON test."RelType1_NodeType1" USING btree 
(start_id, end_id);
   CREATE INDEX
   ```
   
   ```
   issue_2137=# SELECT * FROM cypher('test', $$EXPLAIN (costs off) MATCH 
p=(:NodeType1)-[:RelType1_NodeType1]->(:NodeType2) 
   RETURN p
   $$) AS (result agtype);
                                        QUERY PLAN                              
        
   
-------------------------------------------------------------------------------------
    Hash Join
      Hash Cond: (_age_default_alias_1.end_id = _age_default_alias_2.id)
      ->  Merge Join
            Merge Cond: (_age_default_alias_0.id = 
_age_default_alias_1.start_id)
            ->  Index Scan using idx_n1_id on "NodeType1" _age_default_alias_0
            ->  Index Scan using idx_r1_id on "RelType1_NodeType1" 
_age_default_alias_1
      ->  Hash
            ->  Index Scan using idx_n2_id on "NodeType2" _age_default_alias_2
   (8 rows)
   ```
   
   Also, I would like to reiterate that **querying undirected paths can really 
slow down the performance, so consider using directed paths in MATCH clauses 
wherever possible.**
   
   @neerajx86 The agtype_ functions are primarily intended for internal use. 
You can find a list of available functions in the 
[documentation](https://age.apache.org/age-manual/master/intro/overview.html). 
The documentation is a bit outdated but covers most of the available functions.


-- 
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

Reply via email to