> ## Documentation Index
> Fetch the complete documentation index at: https://new.docs.falkordb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GRAPH.PROFILE

> Executes a query and returns an execution plan augmented with metrics for each operation's execution

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](/commands/graph.query) and [GRAPH.EXPLAIN](/commands/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.

<CodeGroup>
  ```python Python theme={null}
  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)
  ```

  ```javascript JavaScript theme={null}
  import { FalkorDB } from 'falkordb';
  const client = await FalkorDB.connect();
  const graph = client.selectGraph('imdb');
  const query = `\
  MATCH (actor_a:Actor)-[:ACT]->(:Movie)<-[:ACT]-(actor_b:Actor)
  WHERE actor_a <> actor_b
  CREATE (actor_a)-[:COSTARRED_WITH]->(actor_b)
  `;
  const result = await graph.profile(query);
  result.forEach(line => console.log(line));
  ```

  ```java Java theme={null}
  import com.falkordb.*;

  Driver driver = FalkorDB.driver("localhost", 6379);
  Graph graph = driver.graph("imdb");
  String query = """
  MATCH (actor_a:Actor)-[:ACT]->(:Movie)<-[:ACT]-(actor_b:Actor)
  WHERE actor_a <> actor_b
  CREATE (actor_a)-[:COSTARRED_WITH]->(actor_b)
  """;
  ResultSet result = graph.profile(query);
  for (String line : result) {
      System.out.println(line);
  }
  ```

  ```rust Rust theme={null}
  use falkordb::{FalkorClientBuilder, FalkorConnectionInfo};

  let connection_info: FalkorConnectionInfo = "falkor://127.0.0.1:6379"
      .try_into().expect("Invalid connection info");
  let client = FalkorClientBuilder::new()
      .with_connection_info(connection_info)
      .build().expect("Failed to build client");
  let graph = client.select_graph("imdb");
  let query = r#"
  MATCH (actor_a:Actor)-[:ACT]->(:Movie)<-[:ACT]-(actor_b:Actor)
  WHERE actor_a <> actor_b
  CREATE (actor_a)-[:COSTARRED_WITH]->(actor_b)
  "#;
  let result = graph.profile(query)?;
  for line in result {
      println!("{}", line);
  }
  ```

  ```bash Shell theme={null}
  GRAPH.PROFILE imdb \
  "MATCH (actor_a:Actor)-[:ACT]->(:Movie)<-[:ACT]-(actor_b:Actor)
  WHERE actor_a <> actor_b
  CREATE (actor_a)-[:COSTARRED_WITH]->(actor_b)"
  1) "Create | Records produced: 11208, Execution time: 168.208661 ms"
  2) "    Filter | Records produced: 11208, Execution time: 1.250565 ms"
  3) "        Conditional Traverse | Records produced: 12506, Execution time: 7.705860 ms"
  4) "            Node By Label Scan | (actor_a:Actor) | Records produced: 1317, Execution time: 0.104346 ms"
  ```
</CodeGroup>

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="Does GRAPH.PROFILE modify data in the graph?">
    Yes. Unlike `GRAPH.EXPLAIN`, `GRAPH.PROFILE` **actually executes** the query including any write operations (CREATE, DELETE, SET). It simply suppresses the RETURN output and instead shows execution metrics.
  </Accordion>

  <Accordion title="What metrics does GRAPH.PROFILE show?">
    For each operation in the execution plan, it shows the number of **records produced** and the **execution time** in milliseconds. This helps identify which operations are the most expensive.
  </Accordion>

  <Accordion title="What is the difference between GRAPH.EXPLAIN and GRAPH.PROFILE?">
    `GRAPH.EXPLAIN` shows the planned execution without running the query. `GRAPH.PROFILE` actually runs the query and reports real execution metrics (records produced, time per operation) but does not return query results.
  </Accordion>

  <Accordion title="Will GRAPH.PROFILE return results from a RETURN clause?">
    No. `GRAPH.PROFILE` suppresses the result set that would normally be produced by a `RETURN` clause. It only outputs the execution plan with runtime statistics.
  </Accordion>
</AccordionGroup>
