Slide 56
Slide 56 text
How people build software
! 56
!
Recap
• Rule #1: Any columns involved in queries should be covered by an index
• *but avoid redundant and unused indexes
• *sometimes an index prefix is needed and sufficient
• Rule #2: Use an OR to return records satisfying one or more of several conditions
• *but a UNION might be necessary to exploit the indexes
• Rule #3: If there’s an index over all the fields in your query, you’re all set
• *if MySQL is making the wrong choice, help it make the right one
• Rule #4: Avoid redundant data across tables
• *except when reads are slow, read/write ratio is high, you can denormalize