1. A computer-implemented method, comprising steps of: a database server receiving a certain query, wherein said certain query references a view; in response to receiving said certain query, said database server: determining whether or not to defer a XML rewrite of a certain query until after performing a view merge of said certain query; in response to determining to defer said XML rewrite of said certain query: performing a view merge of said certain query; and subsequent to performing said view merge of said certain query, performing said XML rewrite of said certain query; in response to determining not to defer said XML rewrite of said certain query, performing said XML rewrite; and subsequent to performing said XML rewrite, performing said view merge of said certain query; and executing said certain query.