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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.