What are the different ways to optimize a MySQL query?
- Don't use "sp_" while creating a stored procedure.
- Don't use "*" while you are using the SELECT command. Also avoid unnecessary columns in SELECT clause.
- You can use table aliases while writing queries.
- Avoid the usage of the wildcard (%) at the starting of a predicate.
- DISTINCT and UNION need to be used solely if it is necessary.
BY Best Interview Question ON 20 Sep 2022