How to write an optimized query in MySQL?
To write an optimized query in MySQL, below are some guidelines:
- Functions should not be used in predicates.
- At the beginning of predicates, do not use the wildcard symbols such as %.
- Use only needed columns in the SELECT clause.
- Always use the inner join option.
- Use of the “Order by” clause is necessary for SQL, in case of assuming the sorted results.