Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Limit  (cost=1192377.73..1192377.85 rows=12 width=90) (actual time=4783.578..4783.596 rows=12 loops=1)
  2.   ->  Unique  (cost=1192377.73..1192395.89 rows=1816 width=90) (actual time=4783.577..4783.586 rows=12 loops=1)
  3.         ->  Sort  (cost=1192377.73..1192382.27 rows=1816 width=90) (actual time=4783.576..4783.578 rows=12 loops=1)
  4.               Sort Key: (sum(COALESCE(((channels.metrics ->> 'viewers'::text))::integer, 0))) DESC, segments.game_id, (count(broadcasts.id))
  5.               Sort Method: quicksort  Memory: 411kB
  6.               ->  GroupAggregate  (cost=1191506.47..1192279.42 rows=1816 width=90) (actual time=4731.425..4780.437 rows=2239 loops=1)
  7.                     Group Key: segments.game_id
  8.                     ->  Sort  (cost=1191506.47..1191614.30 rows=43131 width=114) (actual time=4731.404..4752.587 rows=46780 loops=1)
  9.                           Sort Key: segments.game_id
  10.                           Sort Method: external merge  Disk: 6472kB
  11.                           ->  Nested Loop  (cost=1.00..1185529.65 rows=43131 width=114) (actual time=214.650..4593.009 rows=46780 loops=1)
  12.                                 ->  Nested Loop  (cost=0.43..949955.16 rows=7445 width=77) (actual time=214.606..4040.531 rows=38423 loops=1)
  13.                                       ->  Seq Scan on broadcasts  (cost=0.00..903461.73 rows=7887 width=53) (actual time=214.565..3769.027 rows=38489 loops=1)
  14.                                             Filter: ((deleted_at IS NULL) AND (ends_at IS NULL) AND (channel_id IS NOT NULL) AND (type = 'system_recorded'::broadcast_type) AND (starts_at <= now()) AND (starts_at >= (now() - '10 days'::interval)))
  15.                                             Rows Removed by Filter: 17444690
  16.                                       ->  Index Scan using channels_id_key on channels  (cost=0.43..5.89 rows=1 width=77) (actual time=0.005..0.005 rows=1 loops=38489)
  17.                                             Index Cond: (id = (broadcasts.channel_id)::uuid)
  18.                                             Filter: ((deleted_at IS NULL) AND (metrics IS NOT NULL))
  19.                                             Rows Removed by Filter: 0
  20.                                 ->  Index Scan using segments_broadcast_idx on segments  (cost=0.57..31.58 rows=6 width=74) (actual time=0.012..0.013 rows=1 loops=38423)
  21.                                       Index Cond: (broadcast_id = (broadcasts.id)::text)
  22.                                       Filter: ((game_id IS NOT NULL) AND (deleted_at IS NULL) AND (segment_type = 'game_played'::segment_type))
  23.                                       Rows Removed by Filter: 1
  24. Planning time: 1.111 ms
  25. Execution time: 4785.401 ms
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement