Prakash Thapa
Prakash Thapa

Reputation: 1285

How to track query execution time in N1QL of couchbase server?

Is there any easy way to get query time in couchbase server's N1QL like .explain() in mongodb?

I have a query like SELECT c.name, c.description from customer c and I would like to trace the time.

Upvotes: 3

Views: 667

Answers (1)

Simon Baslé
Simon Baslé

Reputation: 28351

in N1QL, responses are JSON and include metadata. the metrics field contains statistics, including the time taken to execute the query (so notably elapsedTime and executionTime).

in the 2.2.0 developer preview of the Java SDK, you can access these metrics as a QueryMetrics object using the info() method on the QueryResult.

Upvotes: 1

Related Questions