How can the query time be measured when executing the query (such as (between centralization, closeness centralization, .....) the execution time does not appear, i.e. when executing does not know how long it takes. with many thanks
Asked
Active
Viewed 97 times
1 Answers
1
If it is OK to see the timing after the execution, try this:
CREATE QUERY MyQuery(...) FOR GRAPH MyGraph {
DATETIME before;
start = SomeVertex.*;
before = now();
<black magic here>
PRINT("Black magic took " + to_string(datetime_diff(now(), before)) + " seconds") AS timing;
PRINT <black magic results>;
}
and then you will see this in the result set:
{
"timing": "Black magic took 5 seconds"
},
Note: the lowest resolution is seconds. If you need better precision (or the code executes within less than a second), then try one of the following options:
- Use an external timer, like Unix/Linux
time
. This is best executed on the TigerGraph server to eliminate/reduce impact of network lag). E.g.
time gsql -g MyGraph "RUN QUERY MyQuery(param1, param2)"
- Check execution logs; see this response.
- Simply execute the same logic a 1000 times and then divide the total execution time by 1000 (or whatever multiple gives you a big enough total response time).

Szilard Barany
- 111
- 6