For some reason the following query never ends. However, if I remove the last subquery in the from clause, it runs in 500ms
Any ideas as to why?
select new.app_id, 'support' as domain, 'summary' as type, 90 as interval, json_build_object( 'new', count(new), 'closed', count(closed), ) as data from ( SELECT * from conversations c WHERE c.inserted_at::date > (current_date - (90 || ' days')::interval)::date ) as new, ( SELECT * from conversations c WHERE c.inserted_at::date > (current_date - (90 || ' days')::interval)::date ) as closed group by new.app_id