Skip to content
PHP Ecosystem
Explore

DbSummary

API reference › Debug Core › Panel › Db › DbSummary

final readonly classPHPForge\Debug\Panel\Db\DbSummary
Sourcesrc/Panel/Db/DbSummary.php

Computes request-wide Database metrics without depending on the visible page or active filters.

PropertyTypeDescriptionDefined by
$callers readonlyarray<string, int>Counts captured database queries by trace hash, excluding rows whose trace was not captured (empty hash).DbSummary
$count readonlyintCounts the captured database queries.DbSummary
$duplicates readonlyintCounts queries marked as duplicates.DbSummary
$duration readonlyfloatStores the total query duration in milliseconds.DbSummary
$types readonlyarray<string, string>Encountered SQL command verbs keyed by verb, so adapters can feed them straight into select filters.DbSummary
MethodDescriptionDefined 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
public function __construct(list<PHPForge\Debug\Panel\Db\QueryRow> $rows)

Creates request-wide database metrics.

Parameters

ParameterTypeDescription
$rowslist<QueryRow>Captured query rows the metrics are computed from.
public function excessiveCallerCount(int|null $threshold): int

Counts the call sites that issued at least $threshold statements, or 0 when the threshold is null.

Parameters

ParameterTypeDescription
$thresholdint|nullStatements per call site that flag it, or null to disable the check.

Returns

int: Number of call sites at or above the threshold.

public function hasWarning(int|null $criticalQueryThreshold, int|null $excessiveCallerThreshold): bool

Returns whether the request exceeds either threshold and must be surfaced as a toolbar warning.

Parameters

ParameterTypeDescription
$criticalQueryThresholdint|nullQuery count above which the request is critical, or null to disable.
$excessiveCallerThresholdint|nullStatements per call site that flag it, or null to disable.

Returns

bool: true when either threshold is exceeded; false otherwise.

public function isCritical(int|null $threshold): bool

Returns whether the query count exceeds $threshold, or false when the threshold is null.

Parameters

ParameterTypeDescription
$thresholdint|nullQuery 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.