pritish-moharir commented on issue #2137:
URL: https://github.com/apache/age/issues/2137#issuecomment-2513837886

   Hey @MuhammadTahaNaveed thank you for the quick response, we were able to 
successfully create and use index scan for one of the label properties for ex 
"NodeType1".name in this case.
   
   A few questions we still have are : 
   
   1. The other labels like "NodeType2", "NodeType3" are still running 
sequential scans, so we were wondering if there is a way to index on the joins 
that are happening?
   
   2. One of the queries we are using is like below: 
   
   ```
   SELECT * FROM cypher('graph_name', $$  
   MATCH (n1:NodeType1)  
   WHERE n1.attribute1 = '<value1>'  
     AND n1.attribute2 IN ['<value2>']  
   WITH n1  
   OPTIONAL MATCH (n1)-[:RelType1_NodeType1*1..1]-(n2:NodeType2)  
   WITH n1, n2  
   OPTIONAL MATCH (n1)-[:RelType2_NodeType1*1..1]-(n3:NodeType3)  
   WITH n1, n2, n3  
   OPTIONAL MATCH (n1)-[:RelType3_NodeType1*1..1]-(n4:NodeType4)  
   WITH n1, n2, n3, n4  
   OPTIONAL MATCH (n2)-[:RelType4_NodeType2*1..1]-(n5:NodeType5)  
   WITH n1, n2, n3, n4, n5  
   OPTIONAL MATCH (n3)-[:RelType5_NodeType3*1..1]-(n6:NodeType6)  
   WITH n1, n2, n3, n4, n5, n6  
   OPTIONAL MATCH (n5)-[:RelType6_NodeType5*1..1]-(n7:NodeType7)  
   WITH n1, n2, n3, n4, n5, n6, n7  
   WHERE n7.attribute3 = '<value3>'  
     AND n6.attribute4 = '<value4>'  
     AND n4.attribute5 = '<value5>'  
   WITH DISTINCT(n1) AS n1, n1.attributeKey AS n1_key  
   ORDER BY n1.attributeKey SKIP 0 LIMIT 10  
   OPTIONAL MATCH (n1)-[:RelType7_NodeType1*1..1]-(n8:NodeType8)  
   WITH DISTINCT n8 AS n8, n1, n1.attributeKey AS n1_key, n8.attributeKey AS 
n8_key  
   ORDER BY n1.attributeKey, n8.attributeKey SKIP 0 LIMIT 10  
   OPTIONAL MATCH (n1)-[:RelType8_NodeType1*1..1]-(n9:NodeType9)  
   WITH DISTINCT n9 AS n9, n1, n8, n1.attributeKey AS n1_key, n8.attributeKey 
AS n8_key, n9.attributeKey AS n9_key  
   ORDER BY n1.attributeKey, n8.attributeKey, n9.attributeKey SKIP 0 LIMIT 10  
   OPTIONAL MATCH 
(n1)-[:RelType9_NodeType1*1..1]-(n10:NodeType10)-[:RelType10_NodeType10*1..1]-(n11:NodeType11)
  
   WITH DISTINCT n11 AS n11, n1, n8, n9, n1.attributeKey AS n1_key, 
n8.attributeKey AS n8_key, n9.attributeKey AS n9_key, n11.attributeKey AS 
n11_key  
   ORDER BY n1.attributeKey, n8.attributeKey, n9.attributeKey, n11.attributeKey 
SKIP 0 LIMIT 10  
   RETURN DISTINCT n1 AS NodeType1, n8 AS NodeType8, n9 AS NodeType9, n11 AS 
NodeType11  
   $$) AS (n1 agtype, n8 agtype, n9 agtype, n11 agtype);
   ```
   
   Its a bit complex but we were able to run the index scan for NodeType1 
attribute1 and attribute2, but even after creating index on the other NodeType 
attributes which are also queried, they are running sequential scan. Is there 
something we are missing, do you have any suggestions as to what fields can be 
indexed here? I apologise if this is a very straightforward question but any 
inputs will be really helpful!
   
   
   Please let me know if you need any additional information. Thanks!
   
   
   
   


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