>Even though the docs say that only 1 index is ever used per
>query, I believe that each JOIN can also make use of an index if it
>(this belief is based on the results of the EXPLAIN(s) of queries
>containing JOINed tables. However, I could be completely wrong in this
You appear to be right. A query with 2 self-joins on one table uses both
indexes on the table:
EXPLAIN SELECT c.customerID, c1.customerID, c2.customerID
FROM customers c
INNER JOIN customers c1 ON c.customerID=c1.customerID
INNER JOIN customers c2 ON C.companyName=c2.companyName\G
Perhaps the docs should say "one index per table /or alias/."
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.11 - Release Date: 4/14/2005