Answer the question
In order to leave comments, you need to log in
How to make an index for a query with group by and order by?
The query itself is
SELECT Ad.id, Ad.title, Ad.description, Ad.posting_date, Ad.is_colored_listing, Ad.bg_color, Ad.fg_color, `Adi`.`image_name`, `Adc`.`category_alias`
FROM `daype_ads ` AS `Ad`
LEFT JOIN daype_categories AS `Adc` ON ( `Ad`.`category_id` = `Adc`.`id` )
LEFT JOIN daype_images AS `Adi` ON ( `Ad`.`id` = `Adi` .`ad_id` )
WHERE `city_id` =25
AND `Ad`.`category` =4
AND `Ad`.`status` =1
AND `category_id` =33
GROUP BY `Ad`.`id`
ORDER BY `posting_date ` DESC
LIMIT 20, 20
Executes seconds.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question