ExecutionStats
A typed view over the execution statistics returned in a cursor's `extra.stats` (populated for a profiled run, i.e. when the query ran with the `profile` option).
Surfaces the numbers you actually look at when a query is slow — how much was scanned from indexes vs. full collections, how much was filtered, how long it took, and the peak memory used.
Tags
Table of Contents
Properties
- $data : array<string|int, mixed>
Methods
- __construct() : mixed
- cacheHits() : int
- Number of index entries served from an in-memory index cache.
- cacheMisses() : int
- Number of index lookups that missed the in-memory index cache.
- documentLookups() : int
- Number of documents looked up by their `_id` / `_key` after an index scan.
- executionTime() : float
- Total query execution time, in seconds.
- filtered() : int
- Number of documents removed by `FILTER` conditions after being read.
- fullCount() : int|null
- The total result count ignoring `LIMIT`, or null when `fullCount` was not requested.
- get() : mixed
- A raw statistic by key (see {@see Statistic}), with a fallback default.
- httpRequests() : int
- Number of HTTP requests the coordinator made to DB-servers (cluster).
- peakMemoryUsage() : int
- Peak memory usage of the query, in bytes.
- raw() : array<string, mixed>
- The raw, unmodified `extra.stats` array.
- scannedFull() : int
- Number of documents read by scanning collections in full (no index).
- scannedIndex() : int
- Number of documents read by scanning index ranges.
- writesExecuted() : int
- Number of documents inserted/updated/replaced/removed.
- writesIgnored() : int
- Number of write operations ignored (e.g. `ignoreErrors`).
Properties
$data
public
array<string|int, mixed>
$data
Methods
__construct()
public
__construct(array<string, mixed> $data) : mixed
Parameters
- $data : array<string, mixed>
-
The raw
extra.statsarray.
cacheHits()
Number of index entries served from an in-memory index cache.
public
cacheHits() : int
Return values
intcacheMisses()
Number of index lookups that missed the in-memory index cache.
public
cacheMisses() : int
Return values
intdocumentLookups()
Number of documents looked up by their `_id` / `_key` after an index scan.
public
documentLookups() : int
Return values
intexecutionTime()
Total query execution time, in seconds.
public
executionTime() : float
Return values
floatfiltered()
Number of documents removed by `FILTER` conditions after being read.
public
filtered() : int
Return values
intfullCount()
The total result count ignoring `LIMIT`, or null when `fullCount` was not requested.
public
fullCount() : int|null
Return values
int|nullget()
A raw statistic by key (see {@see Statistic}), with a fallback default.
public
get(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
httpRequests()
Number of HTTP requests the coordinator made to DB-servers (cluster).
public
httpRequests() : int
Return values
intpeakMemoryUsage()
Peak memory usage of the query, in bytes.
public
peakMemoryUsage() : int
Return values
intraw()
The raw, unmodified `extra.stats` array.
public
raw() : array<string, mixed>
Return values
array<string, mixed>scannedFull()
Number of documents read by scanning collections in full (no index).
public
scannedFull() : int
Return values
intscannedIndex()
Number of documents read by scanning index ranges.
public
scannedIndex() : int
Return values
intwritesExecuted()
Number of documents inserted/updated/replaced/removed.
public
writesExecuted() : int
Return values
intwritesIgnored()
Number of write operations ignored (e.g. `ignoreErrors`).
public
writesIgnored() : int