Marc-André Bombeck
bf1d87499f
perf(analytics): cap slim-slice narrows query at 90 days (v1.4.47.1)
...
The narrows query inside computeFromRollups scanned the user's full
measurements partition without an outer measured_at cap even though
every aggregate FILTER inside the SELECT restricted to 7/30/90 days.
On a ~450k-row tenant the cold slim slice paid ~9s TTFB to read rows
that were always aggregated to NULL.
Adding AND m.measured_at >= NOW() - INTERVAL '90 days' to the outer
WHERE turns the read into an index range scan on
(user_id, type, measured_at) and returns bit-identical output.
Expected: ~9s -> ~0.5-1s cold, sub-50ms warm.
No schema change, no migration, no env-var change.
2026-05-22 10:48:53 +02:00
..
2026-05-21 23:13:21 +02:00
2026-05-21 23:13:21 +02:00
2026-05-22 10:48:53 +02:00
2026-05-14 23:49:32 +02:00
2026-05-21 23:13:21 +02:00
2026-05-17 19:07:03 +02:00
2026-05-21 19:33:07 +02:00
2026-05-21 12:48:02 +02:00
2026-05-11 08:27:51 +02:00
2026-05-22 09:18:52 +02:00
2026-05-21 18:36:17 +02:00
2026-05-10 11:05:40 +02:00
2026-05-16 21:25:26 +02:00
2026-05-21 22:07:32 +02:00
2026-05-16 21:25:26 +02:00
2026-05-21 19:33:07 +02:00
2026-05-22 09:18:52 +02:00
2026-05-22 09:18:52 +02:00
2026-05-21 19:33:07 +02:00
2026-05-21 19:33:07 +02:00
2026-05-21 19:33:07 +02:00
2026-03-10 20:14:33 +01:00
2026-05-21 12:48:02 +02:00
2026-05-21 12:48:02 +02:00
2026-05-16 21:25:26 +02:00
2026-05-21 19:33:07 +02:00
2026-05-09 21:19:18 +02:00
2026-05-21 18:36:17 +02:00
2026-05-22 01:06:55 +02:00
2026-05-21 19:33:07 +02:00
2026-05-21 19:33:07 +02:00
2026-05-14 23:49:32 +02:00
2026-05-10 22:12:22 +02:00
2026-05-14 23:49:32 +02:00
2026-05-21 19:33:07 +02:00
2026-05-21 12:48:02 +02:00
2026-05-22 09:18:52 +02:00
2026-05-21 22:07:32 +02:00
2026-05-16 19:46:43 +02:00
2026-05-21 19:33:07 +02:00
2026-05-09 02:27:17 +02:00
2026-05-21 23:13:21 +02:00
2026-05-08 14:33:39 +02:00
2026-05-21 18:36:17 +02:00
2026-05-17 09:55:33 +02:00
2026-05-21 12:48:02 +02:00
2026-05-21 19:33:07 +02:00
2026-05-14 23:49:32 +02:00
2026-05-09 21:36:47 +02:00
2026-05-14 23:49:32 +02:00
2026-05-21 18:36:17 +02:00
2026-05-21 23:13:21 +02:00
2026-05-15 22:59:10 +02:00
2026-05-21 12:48:02 +02:00
2026-03-10 20:14:33 +01:00
2026-05-09 02:22:12 +02:00
2026-05-08 17:46:31 +02:00
2026-05-21 18:36:17 +02:00
2026-05-21 11:20:24 +02:00
2026-03-10 20:14:33 +01:00
2026-05-09 02:27:17 +02:00
2026-05-21 22:07:32 +02:00
2026-04-18 17:15:43 +02:00
2026-05-08 14:33:39 +02:00
2026-05-21 19:33:07 +02:00
2026-05-21 23:13:21 +02:00
2026-05-16 19:46:43 +02:00
2026-05-21 18:36:17 +02:00
2026-05-14 23:49:32 +02:00
2026-05-17 23:46:09 +02:00
2026-03-10 20:14:33 +01:00
2026-04-18 22:20:12 +02:00