optimized db.php