问题
Recently we encountered a performance degradation and in some cases even partial results, once we have transitioned from recreating the DSLContext on every call to creating it once and reusing it. Practically we transitioned from this -
//Method call
try (Connection c = dataSource.getConnection()) {
DSLContext dsl = DSL.using(c);
return dsl.select().from(view).where(condition).fetchSize(1000).fetchLazy();
}
to this -
//Ctor
this.dsl = DSL.using(dataSource, SQLDialect.DEFAULT);
//Method call
dsl.select().from(view).where(condition).getQuery().fetchSize(1000).fetchLazy();
Was hoping to get some lead what could cause this.
来源:https://stackoverflow.com/questions/57875498/performance-degradation-when-reusing-dslcontext-in-jooq