Improved peormance of SQL query by pre caching sql method factories