markgomer commented on issue #1239:
URL: https://github.com/apache/age/issues/1239#issuecomment-1730192767

   Hi @cho2hhun! 
   
   You can put the command EXPLAIN with the cypher queries, but AGE still is 
PostgreSQL tables arranged as a graph, so it is essentially transforming the 
Cypher query into an SQL query that operates on PostgreSQL tables:
   
   ```cypher
   test=# SELECT * FROM cypher('agload', 
           $$
                   EXPLAIN MATCH (co:Country {name:"Albania"})-[e]-(ci:City)
                   RETURN co, e, ci
           $$) 
           as (co agtype, e agtype, ci agtype);
                                                      QUERY PLAN                
                                    
   
-----------------------------------------------------------------------------------------------------------------
    Nested Loop  (cost=0.00..118223792.34 rows=725 width=96)
      Join Filter: (((e.start_id = co.id) AND (e.end_id = ci.id)) OR ((e.end_id 
= co.id) AND (e.start_id = ci.id)))
      ->  Nested Loop  (cost=0.00..3656.49 rows=72485 width=614)
            ->  Seq Scan on "Country" co  (cost=0.00..3.79 rows=1 width=402)
                  Filter: (properties @> agtype_build_map('name'::text, 
'"Albania"'::agtype))
            ->  Seq Scan on "City" ci  (cost=0.00..2927.85 rows=72485 width=212)
      ->  Materialize  (cost=0.00..1982.71 rows=72486 width=29)
            ->  Append  (cost=0.00..1620.28 rows=72486 width=29)
                  ->  Seq Scan on _ag_label_edge e_1  (cost=0.00..0.00 rows=1 
width=56)
                  ->  Seq Scan on has_city e_2  (cost=0.00..1257.85 rows=72485 
width=29)
   (10 rows)
   ```
   
   With EXPLAIN, you can still get insights into the query's cost and how you 
might optimize it, though.
   
   To see how the Cypher is transformed into SQL, you might want to execute the 
query with a debugger, like GDB.
   
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to