MySQL Forums
Forum List  »  Performance

Re: Queries slow down daily, optimizing helps -> why?
Posted by: Rick James
Date: February 26, 2009 08:14PM

Pasted the wrong thing? Those EXPLAINs look the same.

You are not doing an index scan. You want the EXPLAIN to start with person because of
AND person.nachname like '%heg%';
but you have no index on nachname. Suggest adding
or, better yet (for the SELECT you pose):
INDEX(nachname, user_id)

This will require an "index scan" of 'person', instead of 'user'. It may be a bigger index, but still not so big as to blow out cache. The savings will come because it won't have to do 12K probes into the other table.

Ok you are using the index on "user", but it is only about 100K (4 byte key + 4 byte pointer, times 11K rows, + overhead). Because it is so small, most of Aftab's comments don't apply.

Options: ReplyQuote

Written By
March 18, 2009 03:58AM
Re: Queries slow down daily, optimizing helps -> why?
February 26, 2009 08:14PM

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.