DbSummary
API reference › Debug Core › Panel › Db › DbSummary
Computes request-wide Database metrics without depending on the visible page or active filters.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$callers readonly | array<string, | Counts captured database queries by trace hash, excluding rows whose trace was not captured (empty hash). | DbSummary |
$count readonly | int | Counts the captured database queries. | DbSummary |
$duplicates readonly | int | Counts queries marked as duplicates. | DbSummary |
$duration readonly | float | Stores the total query duration in milliseconds. | DbSummary |
$types readonly | array<string, | Encountered SQL command verbs keyed by verb, so adapters can feed them straight into select filters. | DbSummary |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates request-wide database metrics. | DbSummary |
excessiveCallerCount() | Counts the call sites that issued at least $threshold statements, or 0 when the threshold is null. | DbSummary |
hasWarning() | Returns whether the request exceeds either threshold and must be surfaced as a toolbar warning. | DbSummary |
isCritical() | Returns whether the query count exceeds $threshold, or false when the threshold is null. | DbSummary |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(list<PHPForge\Debug\Panel\Db\QueryRow> $rows)Creates request-wide database metrics.
Parameters
| Parameter | Type | Description |
|---|---|---|
$rows | list<QueryRow> | Captured query rows the metrics are computed from. |
excessiveCallerCount()
Section titled “excessiveCallerCount() ”public function excessiveCallerCount(int|null $threshold): intCounts the call sites that issued at least $threshold statements, or 0 when the threshold is null.
Parameters
| Parameter | Type | Description |
|---|---|---|
$threshold | int| | Statements per call site that flag it, or null to disable the check. |
Returns
int: Number of call sites at or above the threshold.
hasWarning()
Section titled “hasWarning() ”public function hasWarning(int|null $criticalQueryThreshold, int|null $excessiveCallerThreshold): boolReturns whether the request exceeds either threshold and must be surfaced as a toolbar warning.
Parameters
| Parameter | Type | Description |
|---|---|---|
$criticalQueryThreshold | int| | Query count above which the request is critical, or null to disable. |
$excessiveCallerThreshold | int| | Statements per call site that flag it, or null to disable. |
Returns
bool: true when either threshold is exceeded; false otherwise.
isCritical()
Section titled “isCritical() ”public function isCritical(int|null $threshold): boolReturns whether the query count exceeds $threshold, or false when the threshold is null.
Parameters
| Parameter | Type | Description |
|---|---|---|
$threshold | int| | Query count above which the request is critical, or null to disable the check. |
Returns
bool: true when the captured query count exceeds the threshold; false otherwise.