How to check the DQL execution plan

I used the explain keyword in Dgraph 24.0.5 but got the error “Invalid operation type: explain.”

explain {
	getUsers(func: has(name)) {
    name
    follows {
      name
    }
  }
}

I would appreciate it if you could let me know how to get the execution plan of a query, similar to MySQL.

We dont’ have any query plan as of right now. Since the query structure is a graph, we really don’t change much like in mysql. We have to traverse the graph in the manner the query specifies.

How do I check if the DQL I created is optimized?
I would really appreciate it if you could tell me how to check how the query is executed.

There’s no way to check if the DQL is optimized or not. If you think the performance is not upto the mark, then we can take a look and help you see how to optimize it. The query will get executed just as you input it. You could look at the traces generated by Dgraph to see what the query did.

@leo_berglin Also have a look at the extensions field in the results. Looking at the UID count your query produced is the first step at optimizing queries. Then, I recommend you search this forum for “optimize” and you’ll uncover all sorts of threads on the subject.

@matthewmcneely thanks for your help