Techniques for Query Optimization
Use Indexing – Indexes improve search performance.
Optimize Joins – Use proper indexing in joins.
Avoid SELECT * – Retrieve only necessary columns.
Use Proper Data Types – Reduce storage and improve performance.
Example: Creating an Index
CREATE INDEX idx_salary ON employees (salary);
Example: Optimizing a Query
SELECT name, department FROM employees WHERE salary > 50000;