Dont use count(*) but rather count(column) so that indexes can help us
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 42s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m51s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s

This commit is contained in:
2024-09-10 14:52:35 +10:00
parent 2d75c92afb
commit 832b496b0b
4 changed files with 18 additions and 15 deletions

View File

@@ -110,7 +110,7 @@ class Domain extends Model
{
return Cache::remember(md5(sprintf('%d-%s',$this->id,$systems?->pluck('id')->join(','))),self::CACHE_TIME,function() use ($systems) {
return DB::query()
->select(['echoareas.name','echoareas.show',DB::raw('COUNT(*) AS count'),DB::raw('datetime::date AS date')])
->select(['echoareas.name','echoareas.show',DB::raw('COUNT(echoareas.name) AS count'),DB::raw('datetime::date AS date')])
->from($this->getTable())
->join('echoareas',['echoareas.domain_id'=>'domains.id'])
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'])