A formal perspective on the view selection problem