From time to time I see people asking "What do I index to join these tables efficiently?" Often, someone just gives them an answer without really explaining the basic theory behind how to index for joins. The purpose of this document is to describe the basic theory behind indexing for joins with MySQL, starting first with a very simple example that demonstrates the basic principle of MySQL joins, and then applying the principle to a more complex 4 table query. A Simple 3 Table Query I want to make the test data as painlessly...
查看详细内容 >>