Jump to content

Indexes and Left Joins


Crusader

Recommended Posts

Please help me figure out what index to put in for this. I see this in all my slow logs since it doesn't use indexes. It's called on pretty much every page on my forum.

 

SELECT moderator.mid as is_mod, moderator.allow_warn, m.*, g.*
FROM ibf_members m
LEFT JOIN ibf_groups g ON (g.g_id=m.mgroup)
LEFT JOIN ibf_moderators moderator ON (moderator.member_id=m.id OR moderator.group_id=m.mgroup )
WHERE m.id=592;

 

id 	select_type 	table 	type 	possible_keys 	key 	key_len 	ref 	rows 	Extra
1 	SIMPLE 	m 	const 	PRIMARY,id 	PRIMARY 	3 	const 	1 	 
1 	SIMPLE 	g 	const 	PRIMARY 	PRIMARY 	4 	const 	1 	 
1 	SIMPLE 	moderator 	ALL 	group_id,member_id 	NULL 	NULL 	NULL 	30

 

I can't, for the life of me, figure this out.

Link to comment
https://forums.phpfreaks.com/topic/131604-indexes-and-left-joins/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.