1. A method comprising: receiving a first query comprising an outer query that references a first instance of a particular data object and one or more set operators; wherein at least a particular set operator of the one or more set operators includes a particular subquery that references a second instance of the particular data object; based at least in part on the first query, transforming the first query to a second query that does not contain at least the particular subquery or the particular set operator; wherein the second query comprises an added predicate that is based at least in part on the particular subquery; wherein the added predicate references the first instance of the particular data object without referencing the second instance of the particular data object; and wherein the second query is semantically equivalent to the first query; causing execution of the second query instead of the first query; wherein the method is performed by one or more computing devices.