Query Optimization to Meet Performance Guarantees for Wide Area Applications