This version of the documentation is archived and no longer supported.

Evaluate Performance of Current Operations

The following sections describe techniques for evaluating operational performance.

Use the Database Profiler to Evaluate Operations Against the Database

MongoDB provides a database profiler that shows performance characteristics of each operation against the database. Use the profiler to locate any queries or write operations that are running slow. You can use this information, for example, to determine what indexes to create.

For more information, see Database Profiling.

Use db.currentOp() to Evaluate mongod Operations

The db.currentOp() method reports on current operations running on a mongod instance.

Use $explain to Evaluate Query Performance

The explain() method returns statistics on a query, and reports the index MongoDB selected to fulfill the query, as well as information about the internal operation of the query.


To use explain() on a query for documents matching the expression { a: 1 }, in the collection named records, use an operation that resembles the following in the mongo shell:

db.records.find( { a: 1 } ).explain()