mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-19 18:05:41 -05:00
perf(sql):Optimize SQL performance by replacing SQL_CALC_FOUND_ROWS with COUNT(*)
This commit is contained in:
@@ -61,12 +61,9 @@ public class MysqlRepository<T> extends AbstractJdbcRepository<T> {
|
||||
|
||||
@Override
|
||||
public <R extends Record, E> ArrayListTotal<E> fetchPage(DSLContext context, SelectConditionStep<R> select, Pageable pageable, RecordMapper<R, E> mapper) {
|
||||
Integer rows = context.fetchCount(select);
|
||||
Result<R> records = this.pageable(select, pageable).fetch();
|
||||
|
||||
return dslContextWrapper.transactionResult(configuration -> {
|
||||
Integer rows = context.fetchOne("SELECT FOUND_ROWS()").into(Integer.class);
|
||||
return new ArrayListTotal<>(records.map(mapper), rows);
|
||||
});
|
||||
return new ArrayListTotal<>(records.map(mapper), rows);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user