String Functions & Operations: Performance
Module: SQL Fundamentals
**Performance Tips:**
- String functions in WHERE prevent index usage
- Use functional indexes for UPPER/LOWER searches
- Normalize data at insert time when possible
- LIKE with leading % cannot use index
- Store lowercase/uppercase versions for fast searches
Functions in WHERE = Full Table Scan
LIKE with Leading %: Cannot use index
Use Functional Indexes: CREATE INDEX ON users(LOWER(email))
Normalize Early: Pre-store LOWER(email), TRIM(name)
NULL Concatenation: 'John' || NULL || 'Doe' → NULL
String Functions in WHERE Prevent Indexes
Cross-DB Concatenation Differences: || fails in MySQL
LIKE Case Sensitivity Varies by database