The execution plan details if and how indexes are used in a query. In a Java application, running `EXPLAIN SELECT * FROM orders WHERE customer_id =?` shows the query's execution steps, indicating index usage. If the plan mentions 'index scan', it confirms the use of an index, optimizing the query.