Task #7
openStatisticsService streams entire tables through memory
0%
Description
Where: src/main/kotlin/com/articon/base/domain/analytics/statistics/common/services/StatisticsService.kt
- ~20
findAll()calls (lines 72, 100, 126, 201, …) over orders, workers, deliveries, invoices, worker rewards.
What's wrong: The service materializes whole tables into the JVM heap, then filters and aggregates in Kotlin. No pagination, projection, or DB-side aggregation.
Why it matters: Latency and heap footprint scale linearly with table size. Once any of those tables grows into the millions of rows, analytics endpoints OOM the JVM (4 GB heap per gradle.properties) or stall on network/serialization. Read-replica unfriendly.
Suggested fix: Push filters/aggregates into SQL (COUNT/SUM/GROUP BY); add date-range filters at the query layer; consider a materialized stats table refreshed by the existing stats-heartbeat daemon.
No data to display