IntermediatePerformance & Indexes
Create a multi-column (composite) index
The query
SQL
CREATE INDEX idx_emp_dept_salary
ON employees (dept_id, salary DESC);Note
“Column order matters! This index is highly optimized for queries filtering on dept_id and sorting by salary.