Patent ID: 7840552

Claim:
An article of manufacture for processing a query, wherein the article of manufacture comprises a computer readable storage medium storing instructions, and wherein the article of manufacture is operable to: determine that the query includes at least one subquery that is to be correlated or decorrelated; and generate an internal representation of the query that represents the subquery in both correlated and decorrelated form, wherein the internal representation includes at least one virtual table, and the query includes an outer table, and wherein the internal representation represents the query using one or more query blocks and further comprising: selecting a bottom-most query block; determining correlated costs of the query block in response to determining that correlated costs are to be determined; and determining non-correlated costs of the query block in response to determining that non-correlated costs are to be determined, wherein the article of manufacture is operable to: join the virtual table in decorrelated form to the outer table; and join the outer table to the virtual table in decorrelated form.