Tuning Queries and Views
If a query runs slower than expected, check if an index needs to be re-built, or if statistics are too old.
Sometimes, the DBMS may not be executing the plan you had in mind. Common areas of weakness:
- Selections involving null values.
- Selections involving arithmetic or string expressions.
- Selections involving OR conditions.
- Lack of evaluation features like index-only strategies or certain join methods or poor size estimation.
Check the plan that is being used! Then adjust the choice of indexes or rewrite the query/view.