Arithmetic & Numeric Functions: Performance
Module: SQL Fundamentals
**Performance Tips:**
- Calculations in SELECT are cheap (computed per returned row)
- Calculations in WHERE can prevent index usage
- Use computed columns for frequently calculated values
- Aggregate functions require full table scan unless indexed
- Functions on indexed columns break indexes
- DECIMAL math is slower than FLOAT but required for financial precision
Calculations in SELECT are cheap
Avoid calculations in WHERE (breaks indexes)
Use computed columns for repeated calculations
Functions on columns in WHERE: 100x slower
Integer division truncates decimals
NULL in calculations returns NULL
Overflow in large calculations
Using FLOAT for money (rounding errors)
Math functions in WHERE break indexes