- Reference >
- Database Commands >
- Diagnostic Commands >
- top
top¶
On this page
-
top¶ topis an administrative command that returns usage statistics for each collection. You can usetopmetrics to compare the relative performance of your collections against each other.
Definition¶
For every collection, top returns the amount of time, in
microseconds, that each event takes to execute and a
count of how many times each event has executed. The time and
count metrics reset only after you restart your mongod
instance.
Syntax¶
Issue the top command against the admin database:
Event Fields¶
The top command returns usage statistics for the following event
fields:
| Field | Description |
|---|---|
total |
The combination of all readLock and writeLock operations. |
readLock |
Usage statistics for operations that use read locks. These operations include but are not limited to queries and aggregations. |
writeLock |
Usage statistics for operations that use write locks. These operations include but are not limited to inserting, updating, and removing documents. |
queries |
Usage statistics for query operations such as find. The
queries.time and queries.count fields also update
readLock.time and increment readLock.count. |
getmore |
Usage statistics for getMore operations. The
getmore.time and getmore.count fields also update
readLock.time and increment readLock.count. |
insert |
Usage statistics for insert operations. The
insert.time and insert.count fields also update
readLock.time and increment readLock.count. |
update |
Usage statistics for update operations. The
update.time and update.count fields also update
readLock.time and increment readLock.count. |
remove |
Usage statistics for delete operations. The
remove.time and remove.count fields also update
readLock.time and increment readLock.count. |
commands |
Usage statistics for operations such as aggregations, index creation,
and index removal. Depending on the type of command, the
For example, aggregation operations increment |