このクエリは、ウィンドウが大きすぎるためすぐに完了しません。それをスピードアップする方法はありますか?アクティブユーザークエリを高速化
select
gs.date,
(select count(distinct customer_id)
from messages
where direction = 'received'
and created_at between gs.date - interval '89 days' and gs.date)
from
generate_series('2015-07-09'::date, current_date::date, interval '1 day') gs
order by gs.date;
'messages(direction、created_at)'列で複数列のインデックスを試してみてください。 – krokodilko