You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "rafsun42 (via GitHub)" <gi...@apache.org> on 2023/06/12 22:32:49 UTC

[GitHub] [age] rafsun42 opened a new issue, #983: Analayse MATCH clause performance (relationship in-depth)

rafsun42 opened a new issue, #983:
URL: https://github.com/apache/age/issues/983

   (no comment)


-- 
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-unsubscribe@age.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] rafsun42 commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "rafsun42 (via GitHub)" <gi...@apache.org>.
rafsun42 commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1631459464

   @panosfol 
   > Its worth noting that none of this MATCH clauses go through entity_exists, get_label_name or filter_vertices_on_label_id.
   Since we are looking for a replacement of `graphid`, your solution must replace use of `graphid` in these three functions, and anywhere else `graphid` is used.


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] panosfol commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "panosfol (via GitHub)" <gi...@apache.org>.
panosfol commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1613165762

   From my understanding vertices hold information about 2 things. The id of the vertex and the properties (same thing can be said about edges with addition of the start id and the end id. For the sake of this explanation I'll use vertices as example).
   The id in turn holds information about the label that the vertex belongs to and the vertex is stored in the default ag_vertex table plus the table of its label. 
   
   I propose that we make the ID generated by a sequence (or a different kind of algorithm like the UUID generator) and add another field that has the information about the label. 
   One major difference doing it this way is that the ID is immutable therefore changing the label of the the vertex isn't accompanied by changing every edge attached to this vertex, but we can still keep the same performance by having the vertex hold information about its label therefore minimizing the disk reads. 
   Barring the miniscule amount of storage increase for each vertex/edge the performance should stay the same. The problem that remains with this solution is that the vertex is still stored in its label table therefore attaching multiple labels needs another layer of refactoring. Implementing this idea would require us to go in all of the places in the code that use the vertex/edge id to acquire information about the label and instead use the new field of the vertex/edge as argument. Also modify the creation of the label table to hold the new field.


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] panosfol commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "panosfol (via GitHub)" <gi...@apache.org>.
panosfol commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1624043467

   **Multiple relationships**
   
   So I implemented my solution with some basic-not optimal changes, just to make it work and correctly produce a query plan.
   There query that I tested my solution on is : 
   ```
   MATCH (charlie {name: 'Charlie Sheen'})-[:ACTED_IN]->(movie)<-[:DIRECTED]-(director)
   RETURN movie.title, director.name
   ```
   
   I used `ALTER TABLE` command to add a new columnd to the `_ag_label_vertex` and the `_ag_label_edge` tables named (for now) `new_id`. This new column holds the `label_id` after the application of the bit shift mask. After that I changed the following things in the codebase :
   - changed the argument at the `scanNSItemForColumn` function inside the `make_edge_expr` and `make_vertex_expr`
      to `new_id` instead of `id`
   - changed the `_graphid` function to return the `entry_id` without combining it with the `label_id` 
   - changed the `create_edge` and `create_vertex` functions to assign the `label_id` in the new column.
   
   Some of the above changes were made with a not so optimal way in sake of implementing the solution. In case of actual implementation the changes will be correctly calculated and applied.
   
   Below are the 2 query plans, both in PG13 version. The first one is the current state and the second one is afer the changes I made to the codebase:
   ```
                                                                   QUERY PLAN                                                                 
   -------------------------------------------------------------------------------------------------------------------------------------------
    Hash Join  (cost=164.97..330.44 rows=2184 width=64)
      Hash Cond: (movie.id = _age_default_alias_0.end_id)
      ->  Append  (cost=0.00..52.11 rows=2141 width=40)
            ->  Seq Scan on _ag_label_vertex movie_1  (cost=0.00..0.00 rows=1 width=40)
            ->  Seq Scan on "Person" movie_2  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on "Movie" movie_3  (cost=0.00..20.70 rows=1070 width=40)
      ->  Hash  (cost=162.44..162.44 rows=203 width=56)
            ->  Hash Join  (cost=97.59..162.44 rows=203 width=56)
                  Hash Cond: (director.id = _age_default_alias_1.start_id)
                  ->  Append  (cost=0.00..52.11 rows=2141 width=40)
                        ->  Seq Scan on _ag_label_vertex director_1  (cost=0.00..0.00 rows=1 width=40)
                        ->  Seq Scan on "Person" director_2  (cost=0.00..20.70 rows=1070 width=40)
                        ->  Seq Scan on "Movie" director_3  (cost=0.00..20.70 rows=1070 width=40)
                  ->  Hash  (cost=97.36..97.36 rows=19 width=24)
                        ->  Hash Join  (cost=74.55..97.36 rows=19 width=24)
                              Hash Cond: (_age_default_alias_1.end_id = _age_default_alias_0.end_id)
                              Join Filter: _ag_enforce_edge_uniqueness(_age_default_alias_0.id, _age_default_alias_1.id)
                              ->  Seq Scan on "DIRECTED" _age_default_alias_1  (cost=0.00..18.80 rows=880 width=24)
                              ->  Hash  (cost=74.38..74.38 rows=13 width=16)
                                    ->  Hash Join  (cost=52.15..74.38 rows=13 width=16)
                                          Hash Cond: (_age_default_alias_0.start_id = charlie.id)
                                          ->  Seq Scan on "ACTED_IN" _age_default_alias_0  (cost=0.00..18.80 rows=880 width=24)
                                          ->  Hash  (cost=52.12..52.12 rows=3 width=8)
                                                ->  Append  (cost=0.00..52.12 rows=3 width=8)
                                                      ->  Seq Scan on _ag_label_vertex charlie_1  (cost=0.00..0.00 rows=1 width=8)
                                                            Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                                                      ->  Seq Scan on "Person" charlie_2  (cost=0.00..26.05 rows=1 width=8)
                                                            Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                                                      ->  Seq Scan on "Movie" charlie_3  (cost=0.00..26.05 rows=1 width=8)
                                                            Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
   (30 rows)
   
   ```
   
   
   ```
                                                                   QUERY PLAN                                                                 
   -------------------------------------------------------------------------------------------------------------------------------------------
    Hash Join  (cost=164.97..330.44 rows=2184 width=64)
      Hash Cond: (movie.id = _age_default_alias_0.end_id)
      ->  Append  (cost=0.00..52.11 rows=2141 width=48)
            ->  Seq Scan on _ag_label_vertex movie_1  (cost=0.00..0.00 rows=1 width=48)
            ->  Seq Scan on "Person" movie_2  (cost=0.00..20.70 rows=1070 width=48)
            ->  Seq Scan on "Movie" movie_3  (cost=0.00..20.70 rows=1070 width=48)
      ->  Hash  (cost=162.44..162.44 rows=203 width=56)
            ->  Hash Join  (cost=97.59..162.44 rows=203 width=56)
                  Hash Cond: (director.id = _age_default_alias_1.start_id)
                  ->  Append  (cost=0.00..52.11 rows=2141 width=48)
                        ->  Seq Scan on _ag_label_vertex director_1  (cost=0.00..0.00 rows=1 width=48)
                        ->  Seq Scan on "Person" director_2  (cost=0.00..20.70 rows=1070 width=48)
                        ->  Seq Scan on "Movie" director_3  (cost=0.00..20.70 rows=1070 width=48)
                  ->  Hash  (cost=97.36..97.36 rows=19 width=24)
                        ->  Hash Join  (cost=74.55..97.36 rows=19 width=24)
                              Hash Cond: (_age_default_alias_1.end_id = _age_default_alias_0.end_id)
                              Join Filter: _ag_enforce_edge_uniqueness(_age_default_alias_0.id, _age_default_alias_1.id)
                              ->  Seq Scan on "DIRECTED" _age_default_alias_1  (cost=0.00..18.80 rows=880 width=24)
                              ->  Hash  (cost=74.38..74.38 rows=13 width=16)
                                    ->  Hash Join  (cost=52.15..74.38 rows=13 width=16)
                                          Hash Cond: (_age_default_alias_0.start_id = charlie.id)
                                          ->  Seq Scan on "ACTED_IN" _age_default_alias_0  (cost=0.00..18.80 rows=880 width=24)
                                          ->  Hash  (cost=52.12..52.12 rows=3 width=8)
                                                ->  Append  (cost=0.00..52.12 rows=3 width=8)
                                                      ->  Seq Scan on _ag_label_vertex charlie_1  (cost=0.00..0.00 rows=1 width=8)
                                                            Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                                                      ->  Seq Scan on "Person" charlie_2  (cost=0.00..26.05 rows=1 width=8)
                                                            Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                                                      ->  Seq Scan on "Movie" charlie_3  (cost=0.00..26.05 rows=1 width=8)
                                                            Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
   (30 rows)
   ```
   
   Those 2 query plans were generated from the 2 graphs that hold exactly the same info. Im planning on adding more data to see how the query plan changes


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] panosfol commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "panosfol (via GitHub)" <gi...@apache.org>.
panosfol commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1631530907

   @rafsun42 I will look into that, I basically used the queries that I was assigned in the `Relationships in depth` section of neo4j. I will begin the modifications for those 3 functions now.


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] rafsun42 commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "rafsun42 (via GitHub)" <gi...@apache.org>.
rafsun42 commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1629883025

   @panosfol Could you include the full query plan trees as well so I can understand what changes have you made. 


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] panosfol commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "panosfol (via GitHub)" <gi...@apache.org>.
panosfol commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1629945291

   Of course! Here is the complete query plan trees of the above queries:
   
   Query: ```MATCH (charlie {name: 'Charlie Sheen'})-[:ACTED_IN*1..3]-(movie:Movie)
   RETURN movie.title```
   My plan: 
   ``` 
   Nested Loop  (cost=0.01..150165.77 rows=2853333 width=32)
      Join Filter: age_match_vle_terminal_edge(charlie.id, movie.id, _age_default_alias_0.edges)
      ->  Nested Loop  (cost=0.01..342.40 rows=8000 width=40)
            ->  Append  (cost=0.00..182.39 rows=8 width=8)
                  ->  Seq Scan on _ag_label_vertex charlie_1  (cost=0.00..0.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on "Person" charlie_2  (cost=0.00..26.05 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on "Movie" charlie_3  (cost=0.00..26.05 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label1 charlie_4  (cost=0.00..26.05 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label2 charlie_5  (cost=0.00..26.05 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label3 charlie_6  (cost=0.00..26.05 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label4 charlie_7  (cost=0.00..26.05 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label5 charlie_8  (cost=0.00..26.05 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
            ->  Function Scan on age_vle _age_default_alias_0  (cost=0.01..10.01 rows=1000 width=32)
      ->  Materialize  (cost=0.00..26.05 rows=1070 width=40)
            ->  Seq Scan on "Movie" movie  (cost=0.00..20.70 rows=1070 width=40)
   ```
   
   Current Plan: 
   ``` 
   Nested Loop  (cost=0.01..168381.05 rows=3200000 width=32)
      Join Filter: age_match_vle_terminal_edge(charlie.id, movie.id, _age_default_alias_0.edges)
      ->  Nested Loop  (cost=0.01..356.05 rows=8000 width=40)
            ->  Append  (cost=0.00..196.04 rows=8 width=8)
                  ->  Seq Scan on _ag_label_vertex charlie_1  (cost=0.00..0.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on "Person" charlie_2  (cost=0.00..28.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on "Movie" charlie_3  (cost=0.00..28.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label1 charlie_4  (cost=0.00..28.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label2 charlie_5  (cost=0.00..28.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label3 charlie_6  (cost=0.00..28.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label4 charlie_7  (cost=0.00..28.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label5 charlie_8  (cost=0.00..28.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
            ->  Function Scan on age_vle _age_default_alias_0  (cost=0.01..10.01 rows=1000 width=32)
      ->  Materialize  (cost=0.00..28.00 rows=1200 width=40)
            ->  Seq Scan on "Movie" movie  (cost=0.00..22.00 rows=1200 width=40)
   ```
   
   
   
   Query: ```MATCH p = (actor {name: 'Charlie Sheen'})-[:ACTED_IN*2]-(co_actor)
   RETURN relationships(p)```
   My plan: 
   ```
    Nested Loop  (cost=0.01..1199103.45 rows=19975998 width=32)
      Join Filter: age_match_vle_terminal_edge(actor.id, co_actor.id, _age_default_alias_0.edges)
      ->  Nested Loop  (cost=0.01..342.40 rows=8000 width=72)
            ->  Append  (cost=0.00..182.39 rows=8 width=40)
                  ->  Seq Scan on _ag_label_vertex actor_1  (cost=0.00..0.00 rows=1 width=40)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on "Person" actor_2  (cost=0.00..26.05 rows=1 width=40)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on "Movie" actor_3  (cost=0.00..26.05 rows=1 width=40)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label1 actor_4  (cost=0.00..26.05 rows=1 width=40)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label2 actor_5  (cost=0.00..26.05 rows=1 width=40)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label3 actor_6  (cost=0.00..26.05 rows=1 width=40)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label4 actor_7  (cost=0.00..26.05 rows=1 width=40)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Seq Scan on label5 actor_8  (cost=0.00..26.05 rows=1 width=40)
                        Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
            ->  Function Scan on age_vle _age_default_alias_0  (cost=0.01..10.01 rows=1000 width=32)
      ->  Materialize  (cost=0.00..219.81 rows=7491 width=40)
            ->  Append  (cost=0.00..182.36 rows=7491 width=40)
                  ->  Seq Scan on _ag_label_vertex co_actor_1  (cost=0.00..0.00 rows=1 width=40)
                  ->  Seq Scan on "Person" co_actor_2  (cost=0.00..20.70 rows=1070 width=40)
                  ->  Seq Scan on "Movie" co_actor_3  (cost=0.00..20.70 rows=1070 width=40)
                  ->  Seq Scan on label1 co_actor_4  (cost=0.00..20.70 rows=1070 width=40)
                  ->  Seq Scan on label2 co_actor_5  (cost=0.00..20.70 rows=1070 width=40)
                  ->  Seq Scan on label3 co_actor_6  (cost=0.00..20.70 rows=1070 width=40)
                  ->  Seq Scan on label4 co_actor_7  (cost=0.00..20.70 rows=1070 width=40)
                  ->  Seq Scan on label5 co_actor_8  (cost=0.00..20.70 rows=1070 width=40)
   ```
   Current Plan: 
   ```
   Nested Loop  (cost=0.01..1344732.01 rows=22402664 width=32)
      Join Filter: age_match_vle_terminal_edge(actor.id, co_actor.id, _age_default_alias_0.edges)
      ->  Append  (cost=0.00..196.00 rows=8401 width=40)
            ->  Seq Scan on _ag_label_vertex co_actor_1  (cost=0.00..0.00 rows=1 width=40)
            ->  Seq Scan on "Person" co_actor_2  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on "Movie" co_actor_3  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label1 co_actor_4  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label2 co_actor_5  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label3 co_actor_6  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label4 co_actor_7  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label5 co_actor_8  (cost=0.00..22.00 rows=1200 width=40)
      ->  Materialize  (cost=0.01..396.05 rows=8000 width=72)
            ->  Nested Loop  (cost=0.01..356.05 rows=8000 width=72)
                  ->  Append  (cost=0.00..196.04 rows=8 width=40)
                        ->  Seq Scan on _ag_label_vertex actor_1  (cost=0.00..0.00 rows=1 width=40)
                              Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                        ->  Seq Scan on "Person" actor_2  (cost=0.00..28.00 rows=1 width=40)
                              Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                        ->  Seq Scan on "Movie" actor_3  (cost=0.00..28.00 rows=1 width=40)
                              Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                        ->  Seq Scan on label1 actor_4  (cost=0.00..28.00 rows=1 width=40)
                              Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                        ->  Seq Scan on label2 actor_5  (cost=0.00..28.00 rows=1 width=40)
                              Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                        ->  Seq Scan on label3 actor_6  (cost=0.00..28.00 rows=1 width=40)
                              Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                        ->  Seq Scan on label4 actor_7  (cost=0.00..28.00 rows=1 width=40)
                              Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                        ->  Seq Scan on label5 actor_8  (cost=0.00..28.00 rows=1 width=40)
                              Filter: (properties @> agtype_build_map('name'::text, '"Charlie Sheen"'::agtype))
                  ->  Function Scan on age_vle _age_default_alias_0  (cost=0.01..10.01 rows=1000 width=32)
   ```
   
   
   Query: ```MATCH (wallstreet:Movie {title: 'Wall Street'})-[*0..1]-(x)
   RETURN x```
   My plan: 
   ```
    Nested Loop  (cost=0.01..125080.91 rows=2497000 width=32)
      Join Filter: age_match_vle_terminal_edge(wallstreet.id, x.id, _age_default_alias_0.edges)
      ->  Append  (cost=0.00..182.36 rows=7491 width=40)
            ->  Seq Scan on _ag_label_vertex x_1  (cost=0.00..0.00 rows=1 width=40)
            ->  Seq Scan on "Person" x_2  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on "Movie" x_3  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label1 x_4  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label2 x_5  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label3 x_6  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label4 x_7  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label5 x_8  (cost=0.00..20.70 rows=1070 width=40)
      ->  Materialize  (cost=0.01..51.06 rows=1000 width=40)
            ->  Nested Loop  (cost=0.01..46.06 rows=1000 width=40)
                  ->  Seq Scan on "Movie" wallstreet  (cost=0.00..26.05 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('title'::text, '"Wall Street"'::agtype))
                  ->  Function Scan on age_vle _age_default_alias_0  (cost=0.01..10.01 rows=1000 width=32)
   ```
   Current plan: 
   ```
    Nested Loop  (cost=0.01..140263.18 rows=2800333 width=32)
      Join Filter: age_match_vle_terminal_edge(wallstreet.id, x.id, _age_default_alias_0.edges)
      ->  Append  (cost=0.00..196.00 rows=8401 width=40)
            ->  Seq Scan on _ag_label_vertex x_1  (cost=0.00..0.00 rows=1 width=40)
            ->  Seq Scan on "Person" x_2  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on "Movie" x_3  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label1 x_4  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label2 x_5  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label3 x_6  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label4 x_7  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label5 x_8  (cost=0.00..22.00 rows=1200 width=40)
      ->  Materialize  (cost=0.01..53.01 rows=1000 width=40)
            ->  Nested Loop  (cost=0.01..48.01 rows=1000 width=40)
                  ->  Seq Scan on "Movie" wallstreet  (cost=0.00..28.00 rows=1 width=8)
                        Filter: (properties @> agtype_build_map('title'::text, '"Wall Street"'::agtype))
                  ->  Function Scan on age_vle _age_default_alias_0  (cost=0.01..10.01 rows=1000 width=32)
   ```
   
   
   Query: ```MATCH p = (michael {name: 'Michael Douglas'})-->()
   RETURN p```
   My plan: 
   ```
   Hash Join  (cost=264.38..677.64 rows=3970 width=32)
      Hash Cond: (_age_default_alias_1.id = _age_default_alias_0.end_id)
      ->  Append  (cost=0.00..182.36 rows=7491 width=40)
            ->  Seq Scan on _ag_label_vertex _age_default_alias_1_1  (cost=0.00..0.00 rows=1 width=40)
            ->  Seq Scan on "Person" _age_default_alias_1_2  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on "Movie" _age_default_alias_1_3  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label1 _age_default_alias_1_4  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label2 _age_default_alias_1_5  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label3 _age_default_alias_1_6  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label4 _age_default_alias_1_7  (cost=0.00..20.70 rows=1070 width=40)
            ->  Seq Scan on label5 _age_default_alias_1_8  (cost=0.00..20.70 rows=1070 width=40)
      ->  Hash  (cost=263.06..263.06 rows=106 width=96)
            ->  Hash Join  (cost=182.49..263.06 rows=106 width=96)
                  Hash Cond: (_age_default_alias_0.start_id = michael.id)
                  ->  Append  (cost=0.00..69.61 rows=2641 width=56)
                        ->  Seq Scan on _ag_label_edge _age_default_alias_0_1  (cost=0.00..0.00 rows=1 width=56)
                        ->  Seq Scan on "ACTED_IN" _age_default_alias_0_2  (cost=0.00..18.80 rows=880 width=56)
                        ->  Seq Scan on "DIRECTED" _age_default_alias_0_3  (cost=0.00..18.80 rows=880 width=56)
                        ->  Seq Scan on "FATHER_OF" _age_default_alias_0_4  (cost=0.00..18.80 rows=880 width=56)
                  ->  Hash  (cost=182.39..182.39 rows=8 width=40)
                        ->  Append  (cost=0.00..182.39 rows=8 width=40)
                              ->  Seq Scan on _ag_label_vertex michael_1  (cost=0.00..0.00 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on "Person" michael_2  (cost=0.00..26.05 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on "Movie" michael_3  (cost=0.00..26.05 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label1 michael_4  (cost=0.00..26.05 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label2 michael_5  (cost=0.00..26.05 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label3 michael_6  (cost=0.00..26.05 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label4 michael_7  (cost=0.00..26.05 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label5 michael_8  (cost=0.00..26.05 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
   ```
   Current plan: 
   ```
   Hash Join  (cost=283.32..760.35 rows=4873 width=32)
      Hash Cond: (_age_default_alias_1.id = _age_default_alias_0.end_id)
      ->  Append  (cost=0.00..196.00 rows=8401 width=40)
            ->  Seq Scan on _ag_label_vertex _age_default_alias_1_1  (cost=0.00..0.00 rows=1 width=40)
            ->  Seq Scan on "Person" _age_default_alias_1_2  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on "Movie" _age_default_alias_1_3  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label1 _age_default_alias_1_4  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label2 _age_default_alias_1_5  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label3 _age_default_alias_1_6  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label4 _age_default_alias_1_7  (cost=0.00..22.00 rows=1200 width=40)
            ->  Seq Scan on label5 _age_default_alias_1_8  (cost=0.00..22.00 rows=1200 width=40)
      ->  Hash  (cost=281.87..281.87 rows=116 width=96)
            ->  Hash Join  (cost=196.14..281.87 rows=116 width=96)
                  Hash Cond: (_age_default_alias_0.start_id = michael.id)
                  ->  Append  (cost=0.00..73.66 rows=2911 width=56)
                        ->  Seq Scan on _ag_label_edge _age_default_alias_0_1  (cost=0.00..0.00 rows=1 width=56)
                        ->  Seq Scan on "ACTED_IN" _age_default_alias_0_2  (cost=0.00..19.70 rows=970 width=56)
                        ->  Seq Scan on "DIRECTED" _age_default_alias_0_3  (cost=0.00..19.70 rows=970 width=56)
                        ->  Seq Scan on "FATHER_OF" _age_default_alias_0_4  (cost=0.00..19.70 rows=970 width=56)
                  ->  Hash  (cost=196.04..196.04 rows=8 width=40)
                        ->  Append  (cost=0.00..196.04 rows=8 width=40)
                              ->  Seq Scan on _ag_label_vertex michael_1  (cost=0.00..0.00 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on "Person" michael_2  (cost=0.00..28.00 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on "Movie" michael_3  (cost=0.00..28.00 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label1 michael_4  (cost=0.00..28.00 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label2 michael_5  (cost=0.00..28.00 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label3 michael_6  (cost=0.00..28.00 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label4 michael_7  (cost=0.00..28.00 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
                              ->  Seq Scan on label5 michael_8  (cost=0.00..28.00 rows=1 width=40)
                                    Filter: (properties @> agtype_build_map('name'::text, '"Michael Douglas"'::agtype))
   ```
   


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] panosfol commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "panosfol (via GitHub)" <gi...@apache.org>.
panosfol commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1625730750

   After making some minor fixes here is the query plan trees for my version and for the current version :
   
   Query: ```MATCH (charlie {name: 'Charlie Sheen'})-[:ACTED_IN*1..3]-(movie:Movie)
   RETURN movie.title```
   My plan: ```Nested Loop  (cost=0.01..150165.77 rows=2853333 width=32)```
   Current Plan: ```Nested Loop  (cost=0.01..168381.05 rows=3200000 width=32)```
   
   
   Query: ```MATCH p = (actor {name: 'Charlie Sheen'})-[:ACTED_IN*2]-(co_actor)
   RETURN relationships(p)```
   My plan: ```Nested Loop  (cost=0.01..1199103.45 rows=19975998 width=32)```
   Current Plan: ```Nested Loop  (cost=0.01..1344732.01 rows=22402664 width=32)```
   
   
   Query: ```MATCH (wallstreet:Movie {title: 'Wall Street'})-[*0..1]-(x)
   RETURN x```
   My plan: ```Nested Loop  (cost=0.01..125080.91 rows=2497000 width=32)```
   Current plan: ```Nested Loop  (cost=0.01..140263.18 rows=2800333 width=32)```
   
   
   Query: ```MATCH p = (michael {name: 'Michael Douglas'})-->()
   RETURN p```
   My plan: ```Hash Join  (cost=264.38..677.64 rows=3970 width=32)```
   Current plan: ```Hash Join  (cost=283.32..760.35 rows=4873 width=32)```
   
   Its worth noting that none of this `MATCH` clauses go through `entity_exists`, `get_label_name` or `filter_vertices_on_label_id`.


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] panosfol commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "panosfol (via GitHub)" <gi...@apache.org>.
panosfol commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1593440634

   Im interested in working on this issue


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] rafsun42 commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "rafsun42 (via GitHub)" <gi...@apache.org>.
rafsun42 commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1631551373

   @panosfol You don't have to actually modify the functions yet. You can roughly explain if your approach would be feasible for those three 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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] panosfol commented on issue #983: Analyse MATCH clause performance (relationship in-depth)

Posted by "panosfol (via GitHub)" <gi...@apache.org>.
panosfol commented on issue #983:
URL: https://github.com/apache/age/issues/983#issuecomment-1631552912

   @rafsun42 Oh I've already done that in another [comment](https://github.com/apache/age/issues/995#issuecomment-1627313474).


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Analyse MATCH clause performance (relationship in-depth) [age]

Posted by "rafsun42 (via GitHub)" <gi...@apache.org>.
rafsun42 closed issue #983: Analyse MATCH clause performance (relationship in-depth)
URL: https://github.com/apache/age/issues/983


-- 
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-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org