Huawei: improve database performance

This commit is contained in:
Martin.JM
2025-04-12 15:36:14 +02:00
parent 4caf17f238
commit f1daf394bf
@@ -261,7 +261,7 @@ public class HuaweiSampleProvider extends AbstractSampleProvider<HuaweiActivityS
} }
Property deviceProperty = getDeviceIdentifierSampleProperty(); Property deviceProperty = getDeviceIdentifierSampleProperty();
qb.where(deviceProperty.eq(dbDevice.getId()), otherTimestampProperty.ge(timestampFrom)) qb.where(deviceProperty.eq(dbDevice.getId()), otherTimestampProperty.ge(timestampFrom))
.where(timestampProperty.le(timestampTo)) .where(timestampProperty.le(timestampTo), timestampProperty.ge(timestampFrom - 60*60*24)) // The timestamp.ge is necessary for db performance
.orderAsc(timestampProperty); .orderAsc(timestampProperty);
List<HuaweiActivitySample> samples = qb.build().list(); List<HuaweiActivitySample> samples = qb.build().list();
for (HuaweiActivitySample sample : samples) { for (HuaweiActivitySample sample : samples) {