There is no definitive way to do this. Many factors need to be taken into consideration when
designing the database structure, when plans change things can get messy.
Primary keys and correct indexes are critical, but these are no good if you're going to
search a table that results in these not being used and it containing thousands of rows.
Probably the most useful function in MySQL is explain, this will show you what the sql query
is doing and you should be able to play about with different versions of the query to get the
optimal performance for your situation.
MySQL now has profiling
) this should help
show up bottlenecks in your existing setup with an aim to increasing performance.