The cost and constraint in query processing