When joining database tables, index tables can greatly improve performance. Unless the proper indexes are available, queries that use joins can take a long time.
In this example, the dept and
emp database tables are being joined using the
dept_id field. When the driver executes a query that contains a join, it processes the tables from left to right and uses an index on the second table’s join field (the
dept field of the
emp table).
To improve join performance, you need an index on the join field of the second table in the FROM clause. If there is a third table in the FROM clause, the driver also uses an index on the field in the third table that joins it to any previous table. For example: