I am working with TigerGraph on a project that involves processing a large dataset; and I am facing some performance challenges. Specifically; the queries I am running are taking longer than expected; and I am looking for advice on how to optimize them for better performance.
I am working with a graph that contains millions of nodes and edges; and I am using a mix of vertex and edge attributes to filter and traverse the graph.
The queries often include multiple filtering conditions; as well as traversal operations that span several hops.
I have made sure to use the appropriate indexes; but the performance is still suboptimal; especially when scaling up the dataset.
What are some common techniques for improving the execution time of graph queries; especially in cases involving large datasets and complex traversals?
How can I efficiently scale my graph without experiencing performance bottlenecks? Are there specific configurations or setups that can improve performance?
Try to modify the part(s) or SELECT statements that take considerable longer amount of time compared to other parts. This can be especially helpful if there are a lot of SELECT statements
Use batching for queries when applicable. While this can result in longer runtimes, it will result in less memory used per batch (e.g. more free memory).
Consider moving the subquery logic into the main query, especially if the subquery has SELECT statements and it was used in ACCUM/POST-ACCUM clauses
Small subqueries that are run outside of ACCUM clauses could be fine
Try not to do too many SELECT statements in your query, especially the ones in loop iteration (if you can avoid it).
E.g. if you have a loop with 10k iterations and each iteration was doing something like 3 SELECT statements, that means it could be doing 30k SELECT statements. Each SELECT statement have a bit of overhead to it, so it could be beneficial in that case to do something like inverting the logic so the iterations are done inside the SELECT statements instead.
Measuring time of each portion of TigerGraph code: