explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wE3p

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 495.584 ↑ 1.0 14 1

Limit (cost=2,941,395.05..2,941,395.82 rows=14 width=1,563) (actual time=495.562..495.584 rows=14 loops=1)

2.          

CTE user_channels

3. 0.029 4.415 ↓ 1.2 93 1

Unique (cost=0.28..1,775.62 rows=75 width=4) (actual time=0.041..4.415 rows=93 loops=1)

4. 4.386 4.386 ↓ 1.2 93 1

Index Scan using sentv_channel_channel_id_idx on sentv_channel c_2 (cost=0.28..1,775.43 rows=75 width=4) (actual time=0.040..4.386 rows=93 loops=1)

  • Filter: ((cardinality(region_dma_codes) > 0) AND (('SUPER'::text = ANY ('{EXTENDED,BASIC}'::text[])) OR ('{EXTENDED,BASIC}'::text[] && ent_keywords)) AND (((channel_id)::text || '_RESTRICTED'::text) <> ALL ('{EXTENDED,BASIC}'::text[])) AND (('NAT'::text = ANY (region_dma_codes)) OR ('NAT-EA'::text = ANY (region_dma_codes)) OR (('547'::text = ANY (region_dma_codes)) AND (('547'::text <> ALL (sub_dmas)) OR ('49228'::text = ANY (sub_dma_zips)) OR (sub_dmas = '{}'::text[]) OR (sub_dma_zips = '{}'::text[])))))
  • Rows Removed by Filter: 1100
5. 0.148 495.582 ↑ 14.2 14 1

WindowAgg (cost=2,939,619.44..2,939,630.38 rows=199 width=1,563) (actual time=495.562..495.582 rows=14 loops=1)

6. 0.003 495.434 ↑ 10.5 19 1

Merge Append (cost=2,939,619.44..2,939,624.41 rows=199 width=1,541) (actual time=495.402..495.434 rows=19 loops=1)

  • Sort Key: rolledupseriesprogram.program_start_date DESC NULLS LAST
7. 0.229 494.935 ↑ 10.4 19 1

Sort (cost=2,939,112.29..2,939,112.79 rows=198 width=1,541) (actual time=494.906..494.935 rows=19 loops=1)

  • Sort Key: rolledupseriesprogram.program_start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 180kB
8. 0.152 494.706 ↑ 10.4 19 1

Nested Loop (cost=14,842.64..2,939,104.74 rows=198 width=1,541) (actual time=16.385..494.706 rows=19 loops=1)

9. 0.142 0.928 ↑ 2.0 98 1

Nested Loop (cost=0.98..450.49 rows=198 width=12) (actual time=0.040..0.928 rows=98 loops=1)

10. 0.198 0.198 ↑ 2.0 98 1

Index Scan using sentv_user_favorite_series_pkey on sentv_user_favorite_series fs (cost=0.56..189.38 rows=198 width=12) (actual time=0.019..0.198 rows=98 loops=1)

  • Index Cond: (profile_id = 4649559)
11. 0.588 0.588 ↑ 1.0 1 98

Index Only Scan using sentv_series_series_id_idx on sentv_series s (cost=0.42..1.31 rows=1 width=4) (actual time=0.006..0.006 rows=1 loops=98)

  • Index Cond: (series_id = fs.series_id)
  • Heap Fetches: 12
12. 0.098 493.626 ↓ 0.0 0 98

Subquery Scan on rolledupseriesprogram (cost=14,841.66..14,841.68 rows=1 width=1,509) (actual time=5.037..5.037 rows=0 loops=98)

  • Filter: (CASE WHEN (rolledupseriesprogram.program_broadcast_date IS NOT NULL) THEN true ELSE (rolledupseriesprogram.broadcast_date >= '2019-09-03 17:24:03.836'::timestamp without time zone) END AND CASE WHEN (rolledupseriesprogram.program_broadcast_date IS NOT NULL) THEN true ELSE (rolledupseriesprogram.broadcast_date <= '2019-09-10 17:24:03.836'::timestamp without time zone) END)
13. 0.098 493.528 ↓ 0.0 0 98

Limit (cost=14,841.66..14,841.66 rows=1 width=1,525) (actual time=5.036..5.036 rows=0 loops=98)

14. 0.686 493.430 ↓ 0.0 0 98

Sort (cost=14,841.66..14,841.66 rows=1 width=1,525) (actual time=5.035..5.035 rows=0 loops=98)

  • Sort Key: (CASE WHEN (((array_agg(a.start_date ORDER BY CASE WHEN (a.calculated_broadcast_date IS NULL) THEN a.broadcast_date ELSE a.calculated_broadcast_date END DESC, CASE WHEN (a.start_date <= now()) THEN a.start_date ELSE '-infinity'::timestamp without time zone END DESC, CASE WHEN (a.start_date > now()) THEN a.start_date ELSE 'infinity'::timestamp without time zone END, a.airing_id))[1]) <= now()) THEN ((array_agg(a.start_date ORDER BY CASE WHEN (a.calculated_broadcast_date IS NULL) THEN a.broadcast_date ELSE a.calculated_broadcast_date END DESC, CASE WHEN (a.start_date <= now()) THEN a.start_date ELSE '-infinity'::timestamp without time zone END DESC, CASE WHEN (a.start_date > now()) THEN a.start_date ELSE 'infinity'::timestamp without time zone END, a.airing_id))[1]) ELSE NULL::timestamp without time zone END) DESC NULLS LAST, (CASE WHEN (((array_agg(a.start_date ORDER BY CASE WHEN (a.calculated_broadcast_date IS NULL) THEN a.broadcast_date ELSE a.calculated_broadcast_date END DESC, CASE WHEN (a.start_date <= now()) THEN a.start_date ELSE '-infinity'::timestamp without time zone END DESC, CASE WHEN (a.start_date > now()) THEN a.start_date ELSE 'infinity'::timestamp without time zone END, a.airing_id))[1]) >= now()) THEN ((array_agg(a.start_date ORDER BY CASE WHEN (a.calculated_broadcast_date IS NULL) THEN a.broadcast_date ELSE a.calculated_broadcast_date END DESC, CASE WHEN (a.start_date <= now()) THEN a.start_date ELSE '-infinity'::timestamp without time zone END DESC, CASE WHEN (a.start_date > now()) THEN a.start_date ELSE 'infinity'::timestamp without time zone END, a.airing_id))[1]) ELSE NULL::timestamp without time zone END)
  • Sort Method: quicksort Memory: 29kB
15. 0.382 492.744 ↓ 2.0 2 98

Nested Loop Left Join (cost=14,839.42..14,841.65 rows=1 width=1,525) (actual time=4.948..5.028 rows=2 loops=98)

  • Filter: (CASE WHEN (whp.percent IS NOT NULL) THEN whp.percent ELSE 0 END <= 0)
  • Rows Removed by Filter: 0
16. 10.388 486.962 ↓ 2.0 2 98

GroupAggregate (cost=14,838.84..14,839.02 rows=1 width=1,487) (actual time=4.908..4.969 rows=2 loops=98)

  • Group Key: p.program_id
17. 1.372 476.574 ↓ 5.0 5 98

Sort (cost=14,838.84..14,838.85 rows=1 width=2,257) (actual time=4.861..4.863 rows=5 loops=98)

  • Sort Key: p.program_id
  • Sort Method: quicksort Memory: 33kB
18. 0.414 475.202 ↓ 5.0 5 98

Nested Loop Anti Join (cost=1.69..14,838.83 rows=1 width=2,257) (actual time=1.694..4.849 rows=5 loops=98)

19. 0.203 471.968 ↓ 5.0 5 98

Nested Loop (cost=1.42..14,831.94 rows=1 width=2,342) (actual time=1.686..4.816 rows=5 loops=98)

20. 83.391 468.440 ↓ 5.0 5 98

Nested Loop (cost=0.85..14,829.22 rows=1 width=2,346) (actual time=1.614..4.780 rows=5 loops=98)

  • Join Filter: (a.channel_id = c.channel_id)
  • Rows Removed by Join Filter: 10598
21. 33.225 306.838 ↓ 114.0 114 98

Nested Loop (cost=0.85..14,826.79 rows=1 width=2,350) (actual time=1.343..3.131 rows=114 loops=98)

22. 62.230 62.230 ↓ 8.5 719 98

Index Scan using sentv_program_series_id_idx on sentv_program p (cost=0.42..88.81 rows=85 width=1,335) (actual time=0.009..0.635 rows=719 loops=98)

  • Index Cond: (series_id = s.series_id)
23. 211.383 211.383 ↓ 0.0 0 70,461

Index Scan using sentv_airing_program_id_idx on sentv_airing a (cost=0.43..173.38 rows=1 width=1,019) (actual time=0.003..0.003 rows=0 loops=70,461)

  • Index Cond: (program_id = p.program_id)
  • Filter: ((CASE WHEN (calculated_broadcast_date IS NULL) THEN broadcast_date ELSE calculated_broadcast_date END >= '2019-09-03 17:24:03.836'::timestamp without time zone) AND (CASE WHEN (calculated_broadcast_date IS NULL) THEN broadcast_date ELSE calculated_broadcast_date END <= '2019-09-10 17:24:03.836'::timestamp without time zone) AND (dvr_expiration_date <> end_date) AND (dvr_expiration_date > now()) AND ((age_rating || '_RESTRICTED'::text) <> ALL ('{EXTENDED,BASIC}'::text[])))
  • Rows Removed by Filter: 1
24. 78.211 78.211 ↓ 1.2 93 11,173

CTE Scan on user_channels c (cost=0.00..1.50 rows=75 width=4) (actual time=0.000..0.007 rows=93 loops=11,173)

25. 3.325 3.325 ↑ 1.0 1 475

Index Scan using sentv_user_favorite_series_pkey on sentv_user_favorite_series fs_1 (cost=0.56..2.71 rows=1 width=12) (actual time=0.006..0.007 rows=1 loops=475)

  • Index Cond: ((profile_id = 4649559) AND (series_id = a.series_id))
  • Filter: ((favorite_date < a.expiration_date) AND (CASE WHEN (a.type = 'vod'::text) THEN 'vod'::text WHEN (now() < a.start_date) THEN 'coming_up'::text WHEN ((now() > a.start_date) AND (now() < a.end_date)) THEN 'live'::text WHEN ((now() < a.dvr_expiration_date) AND (favorite_date < a.end_date)) THEN 'dvr'::text WHEN ((CASE WHEN (a.type = 'vod'::text) THEN a.expiration_date WHEN ((now() < a.dvr_expiration_date) AND (favorite_date < a.end_date)) THEN a.dvr_expiration_date WHEN (a.fallback_startover_date IS NOT NULL) THEN a.fallback_startover_date ELSE a.expiration_date END IS NOT NULL) AND (now() < CASE WHEN (a.type = 'vod'::text) THEN a.expiration_date WHEN ((now() < a.dvr_expiration_date) AND (favorite_date < a.end_date)) THEN a.dvr_expiration_date WHEN (a.fallback_startover_date IS NOT NULL) THEN a.fallback_startover_date ELSE a.expiration_date END)) THEN 'catchup'::text WHEN a.vod_replacement_available THEN 'vod'::text ELSE 'no_longer_available'::text END <> 'no_longer_available'::text) AND (((CASE WHEN (a.type = 'vod'::text) THEN 'vod'::text WHEN (now() < a.start_date) THEN 'coming_up'::text WHEN ((now() > a.start_date) AND (now() < a.end_date)) THEN 'live'::text WHEN ((now() < a.dvr_expiration_date) AND (favorite_date < a.end_date)) THEN 'dvr'::text WHEN ((CASE WHEN (a.type = 'vod'::text) THEN a.expiration_date WHEN ((now() < a.dvr_expiration_date) AND (favorite_date < a.end_date)) THEN a.dvr_expiration_date WHEN (a.fallback_startover_date IS NOT NULL) THEN a.fallback_startover_date ELSE a.expiration_date END IS NOT NULL) AND (now() < CASE WHEN (a.type = 'vod'::text) THEN a.expiration_date WHEN ((now() < a.dvr_expiration_date) AND (favorite_date < a.end_date)) THEN a.dvr_expiration_date WHEN (a.fallback_startover_date IS NOT NULL) THEN a.fallback_startover_date ELSE a.expiration_date END)) THEN 'catchup'::text WHEN a.vod_replacement_available THEN 'vod'::text ELSE 'no_longer_available'::text END <> 'vod'::text) AND (((favorite_date < a.end_date) AND (a.dvr_expiration_date > now())) OR (a.expiration_date > now()))) OR ((CASE WHEN (a.type = 'vod'::text) THEN 'vod'::text WHEN (now() < a.start_date) THEN 'coming_up'::text WHEN ((now() > a.start_date) AND (now() < a.end_date)) THEN 'live'::text WHEN ((now() < a.dvr_expiration_date) AND (favorite_date < a.end_date)) THEN 'dvr'::text WHEN ((CASE WHEN (a.type = 'vod'::text) THEN a.expiration_date WHEN ((now() < a.dvr_expiration_date) AND (favorite_date < a.end_date)) THEN a.dvr_expiration_date WHEN (a.fallback_startover_date IS NOT NULL) THEN a.fallback_startover_date ELSE a.expiration_date END IS NOT NULL) AND (now() < CASE WHEN (a.type = 'vod'::text) THEN a.expiration_date WHEN ((now() < a.dvr_expiration_date) AND (favorite_date < a.end_date)) THEN a.dvr_expiration_date WHEN (a.fallback_startover_date IS NOT NULL) THEN a.fallback_startover_date ELSE a.expiration_date END)) THEN 'catchup'::text WHEN a.vod_replacement_available THEN 'vod'::text ELSE 'no_longer_available'::text END = 'vod'::text) AND (a.vod_ready_date <= now()) AND (a.expiration_date >= now()))))
  • Rows Removed by Filter: 0
26. 2.820 2.820 ↓ 0.0 0 470

Index Scan using sentv_blackout_rule_pkey on sentv_blackout_rule b (cost=0.28..3.56 rows=5 width=1,425) (actual time=0.006..0.006 rows=0 loops=470)

  • Index Cond: ((rule_name)::text = ANY (a.bo_rules))
  • Filter: CASE WHEN (('547'::text = ANY (dmas)) OR ('49228'::text = ANY (zipcodes)) OR ('PS4'::text = ANY (device_types)) OR ((cardinality(media_blackouts) > 0) AND (('547_BLACKOUT'::text = ANY (a.bo_keywords)) OR (a.bo_keywords && media_blackouts)))) THEN CASE WHEN (rule_type = 1) THEN true ELSE false END ELSE CASE WHEN (rule_type = 2) THEN true ELSE false END END
  • Rows Removed by Filter: 0
27. 5.400 5.400 ↓ 0.0 0 180

Index Scan using sentv_user_program_watch_history_pkey on sentv_user_program_watch_history whp (cost=0.57..2.59 rows=1 width=26) (actual time=0.030..0.030 rows=0 loops=180)

  • Index Cond: ((profile_id = 4649559) AND (program_id = p.program_id))
28. 0.002 0.496 ↓ 0.0 0 1

Sort (cost=507.13..507.14 rows=1 width=1,541) (actual time=0.496..0.496 rows=0 loops=1)

  • Sort Key: ((array_agg(a_1.start_date ORDER BY CASE WHEN (a_1.calculated_broadcast_date IS NULL) THEN a_1.broadcast_date ELSE a_1.calculated_broadcast_date END DESC, CASE WHEN (a_1.start_date <= now()) THEN a_1.start_date ELSE '-infinity'::timestamp without time zone END DESC, CASE WHEN (a_1.start_date > now()) THEN a_1.start_date ELSE 'infinity'::timestamp without time zone END, a_1.airing_id))[1]) DESC NULLS LAST
  • Sort Method: quicksort Memory: 25kB
29. 0.001 0.494 ↓ 0.0 0 1

Nested Loop Left Join (cost=504.87..507.12 rows=1 width=1,541) (actual time=0.494..0.494 rows=0 loops=1)

  • Filter: (CASE WHEN (whp_1.percent IS NOT NULL) THEN whp_1.percent ELSE 0 END <= 0)
30. 0.001 0.493 ↓ 0.0 0 1

GroupAggregate (cost=504.30..504.51 rows=1 width=1,495) (actual time=0.493..0.493 rows=0 loops=1)

  • Group Key: p_1.program_id, fp.favorite_date
  • Filter: (CASE WHEN ((array_agg(CASE WHEN (a_1.calculated_broadcast_date IS NULL) THEN a_1.broadcast_date ELSE a_1.calculated_broadcast_date END ORDER BY CASE WHEN (a_1.calculated_broadcast_date IS NULL) THEN a_1.broadcast_date ELSE a_1.calculated_broadcast_date END DESC, CASE WHEN (a_1.start_date <= now()) THEN a_1.start_date ELSE '-infinity'::timestamp without time zone END DESC, CASE WHEN (a_1.start_date > now()) THEN a_1.start_date ELSE 'infinity'::timestamp without time zone END, a_1.airing_id))[1] IS NOT NULL) THEN true ELSE (p_1.broadcast_date >= '2019-09-03 17:24:03.836'::timestamp without time zone) END AND CASE WHEN ((array_agg(CASE WHEN (a_1.calculated_broadcast_date IS NULL) THEN a_1.broadcast_date ELSE a_1.calculated_broadcast_date END ORDER BY CASE WHEN (a_1.calculated_broadcast_date IS NULL) THEN a_1.broadcast_date ELSE a_1.calculated_broadcast_date END DESC, CASE WHEN (a_1.start_date <= now()) THEN a_1.start_date ELSE '-infinity'::timestamp without time zone END DESC, CASE WHEN (a_1.start_date > now()) THEN a_1.start_date ELSE 'infinity'::timestamp without time zone END, a_1.airing_id))[1] IS NOT NULL) THEN true ELSE (p_1.broadcast_date <= '2019-09-10 17:24:03.836'::timestamp without time zone) END)
31. 0.002 0.492 ↓ 0.0 0 1

Sort (cost=504.30..504.30 rows=1 width=2,265) (actual time=0.492..0.492 rows=0 loops=1)

  • Sort Key: p_1.program_id, fp.favorite_date
  • Sort Method: quicksort Memory: 25kB
32. 0.000 0.490 ↓ 0.0 0 1

Nested Loop Anti Join (cost=2.00..504.29 rows=1 width=2,265) (actual time=0.490..0.490 rows=0 loops=1)

33. 0.001 0.490 ↓ 0.0 0 1

Nested Loop (cost=1.73..497.39 rows=1 width=2,350) (actual time=0.490..0.490 rows=0 loops=1)

  • Join Filter: (a_1.channel_id = c_1.channel_id)
34. 0.013 0.489 ↓ 0.0 0 1

Nested Loop (cost=1.73..494.96 rows=1 width=2,354) (actual time=0.489..0.489 rows=0 loops=1)

  • Join Filter: ((fp_1.favorite_date < a_1.expiration_date) AND (fp_1.program_id = a_1.program_id) AND (CASE WHEN (a_1.type = 'vod'::text) THEN 'vod'::text WHEN (now() < a_1.start_date) THEN 'coming_up'::text WHEN ((now() > a_1.start_date) AND (now() < a_1.end_date)) THEN 'live'::text WHEN ((now() < a_1.dvr_expiration_date) AND (fp_1.favorite_date < a_1.end_date)) THEN 'dvr'::text WHEN ((CASE WHEN (a_1.type = 'vod'::text) THEN a_1.expiration_date WHEN ((now() < a_1.dvr_expiration_date) AND (fp_1.favorite_date < a_1.end_date)) THEN a_1.dvr_expiration_date WHEN (a_1.fallback_startover_date IS NOT NULL) THEN a_1.fallback_startover_date ELSE a_1.expiration_date END IS NOT NULL) AND (now() < CASE WHEN (a_1.type = 'vod'::text) THEN a_1.expiration_date WHEN ((now() < a_1.dvr_expiration_date) AND (fp_1.favorite_date < a_1.end_date)) THEN a_1.dvr_expiration_date WHEN (a_1.fallback_startover_date IS NOT NULL) THEN a_1.fallback_startover_date ELSE a_1.expiration_date END)) THEN 'catchup'::text WHEN a_1.vod_replacement_available THEN 'vod'::text ELSE 'no_longer_available'::text END <> 'no_longer_available'::text) AND (((CASE WHEN (a_1.type = 'vod'::text) THEN 'vod'::text WHEN (now() < a_1.start_date) THEN 'coming_up'::text WHEN ((now() > a_1.start_date) AND (now() < a_1.end_date)) THEN 'live'::text WHEN ((now() < a_1.dvr_expiration_date) AND (fp_1.favorite_date < a_1.end_date)) THEN 'dvr'::text WHEN ((CASE WHEN (a_1.type = 'vod'::text) THEN a_1.expiration_date WHEN ((now() < a_1.dvr_expiration_date) AND (fp_1.favorite_date < a_1.end_date)) THEN a_1.dvr_expiration_date WHEN (a_1.fallback_startover_date IS NOT NULL) THEN a_1.fallback_startover_date ELSE a_1.expiration_date END IS NOT NULL) AND (now() < CASE WHEN (a_1.type = 'vod'::text) THEN a_1.expiration_date WHEN ((now() < a_1.dvr_expiration_date) AND (fp_1.favorite_date < a_1.end_date)) THEN a_1.dvr_expiration_date WHEN (a_1.fallback_startover_date IS NOT NULL) THEN a_1.fallback_startover_date ELSE a_1.expiration_date END)) THEN 'catchup'::text WHEN a_1.vod_replacement_available THEN 'vod'::text ELSE 'no_longer_available'::text END <> 'vod'::text) AND (((fp_1.favorite_date < a_1.end_date) AND (a_1.dvr_expiration_date > now())) OR (a_1.expiration_date > now()))) OR ((CASE WHEN (a_1.type = 'vod'::text) THEN 'vod'::text WHEN (now() < a_1.start_date) THEN 'coming_up'::text WHEN ((now() > a_1.start_date) AND (now() < a_1.end_date)) THEN 'live'::text WHEN ((now() < a_1.dvr_expiration_date) AND (fp_1.favorite_date < a_1.end_date)) THEN 'dvr'::text WHEN ((CASE WHEN (a_1.type = 'vod'::text) THEN a_1.expiration_date WHEN ((now() < a_1.dvr_expiration_date) AND (fp_1.favorite_date < a_1.end_date)) THEN a_1.dvr_expiration_date WHEN (a_1.fallback_startover_date IS NOT NULL) THEN a_1.fallback_startover_date ELSE a_1.expiration_date END IS NOT NULL) AND (now() < CASE WHEN (a_1.type = 'vod'::text) THEN a_1.expiration_date WHEN ((now() < a_1.dvr_expiration_date) AND (fp_1.favorite_date < a_1.end_date)) THEN a_1.dvr_expiration_date WHEN (a_1.fallback_startover_date IS NOT NULL) THEN a_1.fallback_startover_date ELSE a_1.expiration_date END)) THEN 'catchup'::text WHEN a_1.vod_replacement_available THEN 'vod'::text ELSE 'no_longer_available'::text END = 'vod'::text) AND (a_1.vod_ready_date <= now()) AND (a_1.expiration_date >= now()))))
35. 0.004 0.212 ↓ 1.7 22 1

Nested Loop (cost=1.30..401.71 rows=13 width=1,359) (actual time=0.057..0.212 rows=22 loops=1)

36. 0.021 0.076 ↓ 1.7 22 1

Merge Join (cost=0.88..370.09 rows=13 width=24) (actual time=0.032..0.076 rows=22 loops=1)

  • Merge Cond: (fp.program_id = fp_1.program_id)
37. 0.021 0.021 ↑ 8.7 22 1

Index Scan using sentv_user_favorite_program_pkey on sentv_user_favorite_program fp (cost=0.44..184.50 rows=192 width=12) (actual time=0.018..0.021 rows=22 loops=1)

  • Index Cond: (profile_id = 4649559)
38. 0.034 0.034 ↑ 8.7 22 1

Index Scan using sentv_user_favorite_program_pkey on sentv_user_favorite_program fp_1 (cost=0.44..184.50 rows=192 width=12) (actual time=0.009..0.034 rows=22 loops=1)

  • Index Cond: (profile_id = 4649559)
39. 0.132 0.132 ↑ 1.0 1 22

Index Scan using sentv_program_pkey on sentv_program p_1 (cost=0.42..2.42 rows=1 width=1,339) (actual time=0.005..0.006 rows=1 loops=22)

  • Index Cond: (program_id = fp_1.program_id)
40. 0.264 0.264 ↓ 0.0 0 22

Index Scan using sentv_airing_program_id_idx on sentv_airing a_1 (cost=0.43..6.98 rows=1 width=1,015) (actual time=0.012..0.012 rows=0 loops=22)

  • Index Cond: (program_id = p_1.program_id)
  • Filter: ((CASE WHEN (calculated_broadcast_date IS NULL) THEN broadcast_date ELSE calculated_broadcast_date END >= '2019-09-03 17:24:03.836'::timestamp without time zone) AND (CASE WHEN (calculated_broadcast_date IS NULL) THEN broadcast_date ELSE calculated_broadcast_date END <= '2019-09-10 17:24:03.836'::timestamp without time zone) AND (dvr_expiration_date <> end_date) AND (dvr_expiration_date > now()) AND ((age_rating || '_RESTRICTED'::text) <> ALL ('{EXTENDED,BASIC}'::text[])))
  • Rows Removed by Filter: 4
41. 0.000 0.000 ↓ 0.0 0

CTE Scan on user_channels c_1 (cost=0.00..1.50 rows=75 width=4) (never executed)

42. 0.000 0.000 ↓ 0.0 0

Index Scan using sentv_blackout_rule_pkey on sentv_blackout_rule b_1 (cost=0.28..3.56 rows=5 width=1,425) (never executed)

  • Index Cond: ((rule_name)::text = ANY (a_1.bo_rules))
  • Filter: CASE WHEN (('547'::text = ANY (dmas)) OR ('49228'::text = ANY (zipcodes)) OR ('PS4'::text = ANY (device_types)) OR ((cardinality(media_blackouts) > 0) AND (('547_BLACKOUT'::text = ANY (a_1.bo_keywords)) OR (a_1.bo_keywords && media_blackouts)))) THEN CASE WHEN (rule_type = 1) THEN true ELSE false END ELSE CASE WHEN (rule_type = 2) THEN true ELSE false END END
43. 0.000 0.000 ↓ 0.0 0

Index Scan using sentv_user_program_watch_history_pkey on sentv_user_program_watch_history whp_1 (cost=0.57..2.59 rows=1 width=26) (never executed)

  • Index Cond: ((profile_id = 4649559) AND (program_id = p_1.program_id))
Planning time : 21.762 ms
Execution time : 496.871 ms