Hey all, I’m having an issue where refreshing continuous aggregates take forever and it seems to be in a “stuck” state. There are no other ongoing hanging queries in db except for the refresh continuous aggregates query, as observed from running the below query.
SELECT pid, now() - query_start AS duration, query
FROM pg_stat_activity
WHERE state = 'active' AND (now() - query_start) > INTERVAL '10 second'
ORDER BY duration DESC;
pid | duration | query
---------+-----------------+------------------------------------------------------------------------------------------------------------------------------------------
2367774 | 01:01:01.727752 | CALL refresh_continuous_aggregate('cagg_a_1h', '2024-06-29T00:00:00Z'::timestamp, '2024-06-30T00:00:00Z'::timestamp)
2367819 | 01:01:01.717308 | CALL refresh_continuous_aggregate('cagg_b_1h', '2024-06-29T00:00:00Z'::timestamp, '2024-06-30T00:00:00Z'::timestamp)
The refreshes are only ran for 1 day worth of data for intervals of 1h.
cagg_a_1h
and cagg_b_1h
are also hierarchical aggregates and they depend on cagg_a_15m
and cagg_b_15m
respectively.
Any idea on what could be causing this?