1. A method for query compilation in a database management system, comprising: estimating a first execution time of code for at least one database query without applying a code generation method and in response to receiving the at least one database query; for one or more code generation methods, estimating a compilation cost and a second execution time of the code as modified by the code generation method; calculating a cost savings for each of the one or more code generation methods, the cost savings calculated as the first execution time less the second execution time of the code generation method, less the compilation cost of the code generation method; and selecting among one of the code generation methods and the no code generation method having a highest cost savings, wherein the one or more code generation methods are based on one or more optimizations to the code, the one or more optimizations including a just-in-time (JIT) compilation method.