Re: Make optimized LEFT JOIN with GROUP BY
Hi Jerry,
I suppose your query looks something like this:
SELECT recipe_id, MAX(picture_id) FROM recipes LEFT JOIN pictures USING (recipe_id) GROUP BY recipe_id
So did you try to add an index to your pictures table spanning _both_ rows, like so KEY (recipe_id, picture_id)? I think this should help, at least in fairly recent versions of MySQL.
Cheers,
Beat
Beat Vontobel
http://www.futhark.ch/mysql
Subject
Views
Written By
Posted
12694
May 03, 2006 08:30AM
Re: Make optimized LEFT JOIN with GROUP BY
5348
May 03, 2006 09:11AM
4253
May 03, 2006 09:20AM
3772
May 03, 2006 09:21AM
6040
May 03, 2006 01:19PM
4163
May 03, 2006 02:38PM
2642
May 03, 2006 02:43PM
3688
May 03, 2006 03:35PM
3625
May 03, 2006 12:58PM
2496
May 03, 2006 01:17PM
2448
May 03, 2006 01:23PM
2353
May 03, 2006 04:03PM
2223
May 03, 2006 04:17PM
4356
May 03, 2006 04:29PM
2491
May 03, 2006 05:09PM
2567
May 03, 2006 05:45PM
2590
May 03, 2006 06:41PM
2381
May 04, 2006 06:05AM
3914
May 04, 2006 08:10AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.