pdpotter commented on issue #45:
URL: https://github.com/apache/age/issues/45#issuecomment-1210541395

   As #228 has been fixed, it is now possible to use GIN indices for adding 
relations.
   After adding GIN indices by executing
   ```
   CREATE INDEX d:LabelA__properties
   ON graph_name.LabelA USING GIN (properties);
   CREATE INDEX d:LabelB__properties
   ON graph_name.LabelB USING GIN (properties);
   ```
   Adding relations using a query like
   ```
   SELECT * FROM cypher('graph_name', $$
   MATCH (d:LabelA {id: 1}), (r:LabelB {id: 2})
   CREATE (d)-[:Relation {prop: 'value'}]->(r)
   $$) as (a agtype);
   ```
   is now over 30 times faster (~300/s on my local VM) than without the GIN 
indices.
   
   I tried improving the performance by creating indices using
   ```
   CREATE INDEX d:LabelA__properties
   ON graph_name.LabelA USING GIN (properties jsonb_path_ops);
   ```
   but `jsonb_path_ops` is not supported for `agtype`.
   
   Another attempt using a specialized index created by
   ```
   CREATE INDEX d:LabelA__properties_id
   ON graph_name.LabelA USING GIN ((properties->'id'));
   ```
   didn't seem to work because the index wasn't used when executing `MATCH` 
queries.
   
   As using GIN indixes is ~30 times slower than the method described in 
https://github.com/apache/age/issues/45#issuecomment-908222122, I think I'm 
going to keep using this other method for initial data import.


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