How Intelligent SQL Optimization Improves Application Performance and Scalability