Postgresql – Time series with running sum of latest orders per tenant
I've a Postgres table like this where a order count for each tenant is inserted when it changes. datetime tenant_id orders 2023-09-15 22:00 tenant3 2 2023-09-16 01:00 tenant1 2 2023-09-16 02:00 tenant1 3 2023-09-16 02:00 tenant2 5 2023-09-16 03:00 tenant1…