I need to get time taken to execute the GSQL
query in TigerGraph
, but the problem is the unit is in seconds
and since the actual time taken is less than a second it always returns as 0, I need a way to change the unit to milliseconds.
Here is the Query I have
CREATE QUERY time() FOR GRAPH nyGraph {
DATETIME before;
before = now();
/* my query logic */
PRINT (datetime_to_epoch(now()) - datetime_to_epoch(before)) as epoch; /* gives 0 */
PRINT datetime_diff(now(), before) as time; /* gives 0 */
}
Output:
[
{
/* Query Results */
},
{
"epoch": 0
},
{
"time": 0
}
]
Yes, indeed, the smallest resolution is seconds. You need an external tool like Unix/Linux/macOS
time
, preferably run on the TigerGraph server to exclude network lag, to get more precise measurements.Alternatively, you can run the same code from a wrapper/outer GSQL query 10,000 times and measure the time in the wrapper query and divide the duration accordingly.