1. One or more non-transitory computer-readable storage media storing instructions, which when executed by one or more processors, performs operations for optimizing query execution, comprising: determining an original runtime for each of multiple execution plans for a query; if execution of the query overlaps with one or more virtual machine (VM) mirroring operations: modifying each of the original runtimes of the execution plans based on time required to perform the mirroring operations if the query were executed according to the execution plan, wherein the time required to perform the mirroring operations is determined based on an estimated number of memory pages that would become dirty and a cost to flash the dirty memory pages, selecting one of the execution plans based on the modified runtimes, and executing the query according to the selected execution plan; and if execution of the query does not overlap with any VM mirroring operations: executing the query according to the execution plan with the fastest original runtime.