Need some help with parallelization of "Select" statements

Hi everyone,

Since I’m very new to Tigergraph and graph databases in general, if anyone could help me with this, I would be very grateful! :slight_smile:

So I’ve been using the developer edition and I read somewhere that one of the benefits of using Tigergraph is that it can perform parallel queries, and thus massively speed up the querying process.

One problem that I’ve ran into is that I have a schema that looks like a star (with a central vertex, and surrounding vertices named for the purpose of this question: outer_vertex1, outer_vertex2, outer_vertex3, etc.) like so:

star.png

And let’s say that I need to perform a query that requires me to go through my data in the following fashion and select just the one single “branch” of the schema: central_vertex -(edge)- outer_vertex

But I need to do that with every branch… Something like this:

all_central_values = {central_vertex.*};

result1 = SELECT cvl FROM all_central_values:cvl -(central_vertex_outer_vertex1)- outer_vertex1:out1
WHERE out1.id in outer_vertex1_values
ACCUM cvl.@outer_vertex1 += true;

result2 = SELECT cvl FROM all_central_values:cvl -(central_vertex_outer_vertex2)- outer_vertex2:out2
WHERE out2.id in outer_vertex2_values
ACCUM cvl.@outer_vertex2 += true;

etc, etc…

So, my question is, is there a way to make these select statements work in parallel, instead of sequentially (like it is now)?

Thanks in advance

You can use gsql as follows to get all type of vertices through any edge type:

result = SELECT cv

         FROM    all_central_values:cv -(:e)-> :out

         WHERE ……

;

If you only need some edge type or some target vertex type, just use “|” to split edge/vertex types. I will show you an example:

result = SELECT cv

         FROM    all_central_values:cv -((central_vertex_outer_vertex1 | central_vertex_outer_vertex2):e)->  (outer_vertex1 | outer_vertex2 | outer_vertex3):out

         WHERE ……

;

For more information please visit https://docs.tigergraph.com/dev/gsql-ref/querying/select-statement#from-clause-vertex-and-edge-sets.