Issue #2388765 by alexpott: Improve performance of SqlContentEntityStorage::countFieldData() for large datasets when getting the result as a boolean
parent
82989783cc
commit
d3e81f5e0d
|
@ -1759,7 +1759,11 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
|
||||||
if ($as_bool) {
|
if ($as_bool) {
|
||||||
$query->range(0, 1);
|
$query->range(0, 1);
|
||||||
}
|
}
|
||||||
$count = $query->countQuery()->execute()->fetchField();
|
else {
|
||||||
|
// Otherwise count the number of rows.
|
||||||
|
$query = $query->countQuery();
|
||||||
|
}
|
||||||
|
$count = $query->execute()->fetchField();
|
||||||
}
|
}
|
||||||
return $as_bool ? (bool) $count : (int) $count;
|
return $as_bool ? (bool) $count : (int) $count;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue