Optimizing a database with multiple tables and >1.5M rows.