2 delete from active_maps_mv;
4 insert into active_maps_mv
5 select row_number() over(order by count(1) desc) sort_order, m.map_id, m.name, count(1) games
6 from maps m join games g on m.map_id = g.map_id
7 where g.create_dt >= now() at time zone 'UTC' - interval '1 week'