1. A method, implemented at least partly by a device, for generating an execution plan for a database query of a database, wherein the database query requires multiple sub-queries to be executed as multiple iterations such that a result of a first one of the sub-queries is needed to be determined in a first iteration of the iterations in order to determine the result of a second one of the sub-quires in a second iteration of the iterations to be performed after the first iteration, and wherein the method comprises: estimating at least one result associated with execution of one or more iterations of the iterations; and generating at least partly based on the at least one estimated result, a first execution plan for executing the one or more iterations.