Two pages of the site are slow. The login page finds a member by username. The support page finds every visit of one user in visits.
- Create an index named
members_username_idxon theusernamecolumn ofmembers. - Show the plan of
SELECT * FROM members WHERE username = 'monster4242'. Which kind of scan does it use? - Create an index named
visits_user_id_idxon theuser_idcolumn ofvisits. - Show the plan of
SELECT * FROM visits WHERE user_id = 4242. What is the first step on the top line of the plan? - The support page moved to another system. Remove
visits_user_id_idx.