Reference documentation and code samples for the Cloud Datastore Client class EntityIterator.
Iterates over a set of Entity items.
Namespace
Google \ Cloud \ DatastoreMethods
moreResultsType
See also:
Returns | |
---|---|
Type | Description |
string|null |
getExplainMetrics
Returns a ExplainMetrics object from the query.
By default, the query does not get executed and the explain metrics object contains only the planning statistics V1\ExplainMetrics.
If the request was configured with the ExplainOptions object Analyze
attribute to true
the request then also gets executed, including the ExecutionStats on the ExplainMetrics
object
Contrary to looping through the result of run query, this method caches the first metrics to avoid variations when analyzing said metrics.
Example:
use Google\Cloud\Datastore\DatastoreClient;
use Google\Cloud\Datastore\V1\ExplainOptions;
$datastore = new DatastoreClient();
explainOptions = (new ExplainOptions())->setAnalyze(false);
$queryOptions = [
'explainOptions' => $explainOptions
];
// The query does not get executed
$res = $datastore->runQuery($query, $queryOptions);
$explainMetrics = $res->getExplainMetrics();
// This is populated
$explainMetrics->planningSummary
// This is not populated
$explainMetrics->executionStats
Example:
explainOptions = (new ExplainOptions())->setAnalyze(true);
$queryOptions = [
'explainOptions' => $explainOptions
];
// The query does not get executed
$res = $datastore->runQuery($query, $queryOptions);
$explainMetrics = $res->getExplainMetrics();
// This is populated
$explainMetrics->getPlanSummary()
// This is also populated
$explainMetrics->getExecutionStats()
Returns | |
---|---|
Type | Description |
null|V1\ExplainMetrics |