How do you optimize slow-running SQL queries in a relational database containing millions of patient records?