How do you optimize database queries to prevent performance bottlenecks in high-transaction applications like Vergent LMS?