1. A computer-implemented method for a database management system (DBMS), the method comprising: identifying a locally invariant variable in general DBMS code that executes a portion of a query whose value is invariant or takes on a deterministic sequence of values within a query evaluation loop; identifying DBMS code that is rendered unnecessary due to the variable being locally invariant; generating micro-specialized DBMS code to replace the DBMS code identified as being unnecessary due to the locally invariant variable, wherein when executed, the micro-specialized DBMS code performs the same function as the unnecessary DBMS code with fewer instructions; modifying the general DBMS code such that the generated micro-specialized DBMS code is executed instead of the unnecessary DBMS code during execution of the query evaluation loop, and further comprising, prior to identifying the locally invariant variable, identifying frequency executed code paths of the general DBMS code by static analysis including constructing a static call graph and dynamic analysis configured to identify a strongly connected component representative of the query evaluation group.