Skip to main content

GRAPH.PROFILE

Executes a query and produces an execution plan augmented with metrics for each operation's execution.

Arguments: Graph name, Query

Returns: String representation of a query execution plan, with details on results produced by and time spent in each operation.

GRAPH.PROFILE is a parallel entrypoint to GRAPH.QUERY. It accepts and executes the same queries, but it will not emit results, instead returning the operation tree structure alongside the number of records produced and total runtime of each operation.

It is important to note that this blends elements of GRAPH.QUERY and GRAPH.EXPLAIN. It is not a dry run and will perform all graph modifications expected of the query, but will not output results produced by a RETURN clause or query statistics.

from falkordb import FalkorDB
client = FalkorDB()
graph = client.select_graph('imdb')
query = '''\
MATCH (actor_a:Actor)-[:ACT]->(:Movie)<-[:ACT]-(actor_b:Actor)
WHERE actor_a <> actor_b
CREATE (actor_a)-[:COSTARRED_WITH]->(actor_b)
'''
result = graph.profile(query)
for line in result:
print(line)