Closed kammor closed 4 years ago
No more N+1 query -> reduces number of queries from 34 to 8 on a page of 10 etablissements fix issue #50
Generated raw query:
select `etablissements`.*, ( 6371 * acos( cos( radians(8.4017790) ) * cos( radians( etablissements.lat ) ) * cos( radians( etablissements.long ) - radians(41.8693620) ) + sin( radians(8.4017790) ) * sin( radians( etablissements.lat ) ) ) ) AS distance, count(services.id) AS nb_services, sum(services.place_disponible) AS places_disponibles, sum(services.place_bientot_disponible) AS places_bientot_disponibles from `etablissements` LEFT JOIN services ON services.etablissement_id=etablissements.`id` GROUP BY etablissements.id order by `distance` asc limit 10 offset 0
No more N+1 query -> reduces number of queries from 34 to 8 on a page of 10 etablissements fix issue #50
Generated raw query: