1. A method comprising: receiving a first query comprising an outer query that: includes one or more set operators; instantiates a particular data object using a first name; references a first instance of the particular data object using said first name; wherein at least a particular set operator of the one or more set operators includes a particular subquery that: instantiates the particular data object using a second name; references a second instance of the particular data object using said second name; 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 using said first name without referencing the second instance of the particular data object using said second name; and wherein the second query is semantically equivalent to the first query; generating an execution plan for executing the second query; causing execution of the second query instead of the first query based on the execution plan for executing the second query; wherein the method is performed by one or more computing devices.
11. The method of claim 1 , further comprising preserving logical relationships between multiple eliminated subqueries, by adding logical operators between multiple added predicates that have been generated based on the multiple eliminated subqueries.