This topic describes how to optimize SQL statements.
Create indexes
After you check the execution plan, you may find that some SQL queries do not use indexes and the query efficiency is low. You can create indexes to improve query performance. The following examples show the difference of query performance before and after you create the index:
- Before creation of the index
- After creation of the index
Use an optimal execution plan
After you check the execution plan, you may find that the execution plan is not optimal and SQL statements are not executed at an expected speed. In this case, you can create an appropriate index to optimize your execution plan. The following examples show the difference of query performance before and after you optimize your execution plan:
- Before optimization of the execution plan
- After optimization of the execution plan
Modify SQL statements
If you cannot improve the efficiency of SQL queries by creating indexes, you need to modify SQL statements for specific optimizations. The following examples show the difference of query performance before and after you modify the SQL statements:
- Before modification of the SQL statements
- After modification of the SQL statements