explain.depesz.com

PostgreSQL's explain analyze made readable

Result: AIJga

Settings
# exclusive inclusive rows x rows loops node
1. 0.135 0.646 ↓ 2.0 6 1

GroupAggregate (cost=84.62..208.18 rows=3 width=533) (actual time=0.503..0.646 rows=6 loops=1)

  • Group Key: th.id
2.          

CTE contacted_theaters_cte

3. 0.000 0.015 ↓ 0.0 0 1

GroupAggregate (cost=27.32..27.52 rows=6 width=50) (actual time=0.015..0.015 rows=0 loops=1)

  • Group Key: ct_1.theater_id
4. 0.008 0.015 ↓ 0.0 0 1

Sort (cost=27.32..27.34 rows=6 width=168) (actual time=0.015..0.015 rows=0 loops=1)

  • Sort Key: ct_1.theater_id
  • Sort Method: quicksort Memory: 25kB
5. 0.001 0.007 ↓ 0.0 0 1

Nested Loop (cost=16.45..27.24 rows=6 width=168) (actual time=0.007..0.007 rows=0 loops=1)

  • Join Filter: (ct_1.user_id = us.id)
6. 0.003 0.006 ↓ 0.0 0 1

Bitmap Heap Scan on data_recovery_contacted_theaters ct_1 (cost=16.45..25.94 rows=6 width=26) (actual time=0.006..0.006 rows=0 loops=1)

  • Recheck Cond: ((contacted_date >= '2019-05-31'::date) AND (contacted_date <= '2019-06-06'::date))
7. 0.003 0.003 ↓ 0.0 0 1

Bitmap Index Scan on uq_contacted_theaters (cost=0.00..16.45 rows=6 width=0) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: ((contacted_date >= '2019-05-31'::date) AND (contacted_date <= '2019-06-06'::date))
8. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..1.04 rows=3 width=158) (never executed)

9. 0.000 0.000 ↓ 0.0 0

Seq Scan on users us (cost=0.00..1.03 rows=3 width=158) (never executed)

10. 0.003 0.469 ↓ 2.0 6 1

Nested Loop Left Join (cost=57.11..155.76 rows=3 width=3,472) (actual time=0.392..0.469 rows=6 loops=1)

  • Join Filter: (((s.country_id)::text = (th.country_id)::text) AND ((s.id)::text = (th.state_id)::text))
11. 0.004 0.460 ↓ 2.0 6 1

Nested Loop Left Join (cost=49.88..143.08 rows=3 width=3,358) (actual time=0.384..0.460 rows=6 loops=1)

  • Join Filter: false
12. 0.003 0.456 ↓ 2.0 6 1

Nested Loop Left Join (cost=49.88..143.05 rows=3 width=3,358) (actual time=0.383..0.456 rows=6 loops=1)

  • Join Filter: (nu.id = mg.user_id)
  • Rows Removed by Join Filter: 18
13. 0.005 0.429 ↓ 2.0 6 1

Nested Loop Left Join (cost=49.88..141.88 rows=3 width=3,216) (actual time=0.363..0.429 rows=6 loops=1)

14. 0.004 0.412 ↓ 2.0 6 1

Nested Loop Left Join (cost=49.73..125.33 rows=3 width=3,196) (actual time=0.354..0.412 rows=6 loops=1)

15. 0.005 0.402 ↓ 2.0 6 1

Nested Loop Left Join (cost=49.59..112.73 rows=3 width=2,196) (actual time=0.348..0.402 rows=6 loops=1)

16. 0.004 0.385 ↓ 2.0 6 1

Nested Loop Left Join (cost=49.44..96.04 rows=3 width=2,160) (actual time=0.340..0.385 rows=6 loops=1)

  • Join Filter: (th.id = id.theater_id)
17. 0.003 0.345 ↓ 2.0 6 1

Nested Loop Left Join (cost=49.29..88.11 rows=3 width=2,155) (actual time=0.305..0.345 rows=6 loops=1)

18. 0.004 0.300 ↓ 2.0 6 1

Nested Loop Left Join (cost=49.14..67.27 rows=3 width=2,151) (actual time=0.281..0.300 rows=6 loops=1)

19. 0.007 0.278 ↓ 2.0 6 1

Merge Left Join (cost=48.99..49.06 rows=3 width=2,149) (actual time=0.273..0.278 rows=6 loops=1)

  • Merge Cond: (th.id = ct.theater_id)
20. 0.040 0.243 ↓ 2.0 6 1

Sort (cost=48.79..48.80 rows=3 width=2,107) (actual time=0.242..0.243 rows=6 loops=1)

  • Sort Key: th.id
  • Sort Method: quicksort Memory: 25kB
21. 0.027 0.203 ↓ 2.0 6 1

Hash Right Join (cost=36.69..48.77 rows=3 width=2,107) (actual time=0.196..0.203 rows=6 loops=1)

  • Hash Cond: (ci.id = th.circuit_id)
22. 0.005 0.005 ↓ 0.0 0 1

Seq Scan on circuits ci (cost=0.00..11.50 rows=150 width=484) (actual time=0.005..0.005 rows=0 loops=1)

23. 0.007 0.171 ↓ 2.0 6 1

Hash (cost=36.66..36.66 rows=3 width=1,639) (actual time=0.171..0.171 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
24. 0.056 0.164 ↓ 2.0 6 1

Seq Scan on theaters th (cost=0.00..36.66 rows=3 width=1,639) (actual time=0.132..0.164 rows=6 loops=1)

  • Filter: (((country_id)::text = 'US'::text) AND (alternatives: SubPlan 4 or hashed SubPlan 5))
25.          

SubPlan (forSeq Scan)

26. 0.108 0.108 ↑ 1.0 1 6

Index Scan using uq_theater_properties_1 on theater_properties (cost=0.16..5.93 rows=1 width=0) (actual time=0.018..0.018 rows=1 loops=6)

  • Index Cond: ((theater_id = th.id) AND (as_of_date >= ('2019-05-31'::date - ('180 DAYS'::cstring)::interval)))
  • Filter: is_reporting
27. 0.000 0.000 ↓ 0.0 0

Index Scan using uq_theater_properties_1 on theater_properties theater_properties_1 (cost=0.16..22.15 rows=1 width=8) (never executed)

  • Index Cond: (as_of_date >= ('2019-05-31'::date - ('180 DAYS'::cstring)::interval))
  • Filter: is_reporting
28. 0.007 0.028 ↓ 0.0 0 1

Sort (cost=0.20..0.21 rows=6 width=50) (actual time=0.028..0.028 rows=0 loops=1)

  • Sort Key: ct.theater_id
  • Sort Method: quicksort Memory: 25kB
29. 0.021 0.021 ↓ 0.0 0 1

CTE Scan on contacted_theaters_cte ct (cost=0.00..0.12 rows=6 width=50) (actual time=0.021..0.021 rows=0 loops=1)

30. 0.018 0.018 ↑ 1.0 1 6

Index Scan using ix_theater_properties_is_reporting on theater_properties pr (cost=0.15..4.59 rows=1 width=10) (actual time=0.003..0.003 rows=1 loops=6)

  • Index Cond: ((theater_id = th.id) AND (as_of_date = '2019-05-31'::date))
31. 0.042 0.042 ↑ 1.0 1 6

Index Scan using ix_theater_aliases_theater_id on theater_aliases ta (cost=0.15..6.94 rows=1 width=12) (actual time=0.006..0.007 rows=1 loops=6)

  • Index Cond: (theater_id = th.id)
  • Filter: ((source_type = 'EXT'::text) AND ((source_id)::text = ANY ('{AMC,AGILE,ALLURE,AZTECADELRIOBRAVO,BNB,BONNERMALL,CMX,CAPRITHEATRE,CARIBBEANCINEMAS,CENTEREDGE,CINELEO,CINECENTRE,CINEMACOLIBRI,CINEMAPARAMOUNT,CINEMAGIC,CINEMARK,CINEMARK-PERU,CINEMASDELCOUNTRY,CINEMASHENRY,CINEMEX,CINEPLANET,CINEPOLIS,CINEPOLISPERU,CINESTAR,CITICINEMAS,COBB-IMPORT,EMS,EASYWARE,EXHIBIDORADELBRAVO,FILMBOT,FINO,HARKINS,KWIC,LANDMARK,LIMELIGHT,LOEKS,LOOKCINEMAS,MJR,MJR2,MALCO,MANUAL-ENTRY,MARCUS,MARQUEE,MAYA,MOVIEHEROES,NCSOFTWARE,NATIONALAMUSEMENTS,OCEANCINEMAS,OMNITERM,OMNITERM-ALT,ORPHEUM,PACIFIC,POHNPEI,RTS,RADIANT,ALT-TAX-RADIANT,RADIANT-HEADQUARTERS,READING,READINGVISTA,REGAL,RETRIEVER,RETRIEVER-AU,RETRIEVER2,SENSIBLE,SOUTHERNTHEATRES,STARLIGHT,STUDIOMOVIEGRILL,SYSTEMBCN,SYUFY,TAPOS,TAPOS-AU,TEXASCINEMAS,THELOT,TITAN,UVK,ULTRASTAR,VEEZI,VENUE,VISTA,WUNDERLANDGAMES}'::text[])))
32. 0.004 0.036 ↓ 0.0 0 6

Materialize (cost=0.15..7.89 rows=1 width=13) (actual time=0.006..0.006 rows=0 loops=6)

33. 0.032 0.032 ↓ 0.0 0 1

Index Scan using ix_theater_aliases_source_id on theater_aliases id (cost=0.15..7.88 rows=1 width=13) (actual time=0.032..0.032 rows=0 loops=1)

  • Index Cond: ((source_id)::text = 'BOE'::text)
34. 0.012 0.012 ↓ 0.0 0 6

Index Scan using uq_data_recovery_justifications on data_recovery_justifications dj (cost=0.15..5.56 rows=1 width=44) (actual time=0.002..0.002 rows=0 loops=6)

  • Index Cond: ((theater_id = th.id) AND (booking_date >= '2019-05-31'::date) AND (booking_date <= '2019-06-06'::date))
35. 0.006 0.006 ↓ 0.0 0 6

Index Scan using pk_justifications on justifications ju (cost=0.14..4.16 rows=1 width=1,032) (actual time=0.001..0.001 rows=0 loops=6)

  • Index Cond: ((id)::text = dj.justification_id)
36. 0.012 0.012 ↓ 0.0 0 6

Index Scan using uq_mg_ignored_dates on data_recovery_mg_ignored_dates mg (cost=0.15..5.51 rows=1 width=28) (actual time=0.002..0.002 rows=0 loops=6)

  • Index Cond: ((theater_id = th.id) AND (ignored_date >= '2019-05-31'::date) AND (ignored_date <= '2019-06-06'::date))
37. 0.010 0.024 ↑ 1.0 3 6

Materialize (cost=0.00..1.04 rows=3 width=158) (actual time=0.003..0.004 rows=3 loops=6)

38. 0.014 0.014 ↑ 1.0 3 1

Seq Scan on users nu (cost=0.00..1.03 rows=3 width=158) (actual time=0.011..0.014 rows=3 loops=1)

39. 0.000 0.000 ↓ 0.0 0 6

Result (cost=0.00..0.00 rows=0 width=0) (actual time=0.000..0.000 rows=0 loops=6)

  • One-Time Filter: false
40. 0.003 0.006 ↓ 0.0 0 6

Materialize (cost=7.22..12.57 rows=2 width=154) (actual time=0.001..0.001 rows=0 loops=6)

41. 0.002 0.003 ↓ 0.0 0 1

Bitmap Heap Scan on states s (cost=7.22..12.56 rows=2 width=154) (actual time=0.003..0.003 rows=0 loops=1)

  • Recheck Cond: ((country_id)::text = 'US'::text)
42. 0.001 0.001 ↓ 0.0 0 1

Bitmap Index Scan on pk_states (cost=0.00..7.22 rows=2 width=0) (actual time=0.001..0.001 rows=0 loops=1)

  • Index Cond: ((country_id)::text = 'US'::text)
43.          

SubPlan (forGroupAggregate)

44. 0.042 0.042 ↑ 1.0 1 6

Index Scan using ix_theaters_distributors_recent_activity_1 on theaters_distributors_recent_activity ra (cost=0.15..8.19 rows=1 width=0) (actual time=0.007..0.007 rows=1 loops=6)

  • Index Cond: (theater_id = th.id)
  • Filter: (((distributor_id)::text = ANY ('{TESTDIST1,TESTDIST2}'::text[])) AND (most_recent_submission >= (now() - ('90 DAYS'::cstring)::interval)))
  • Rows Removed by Filter: 1
45. 0.000 0.000 ↓ 0.0 0

Seq Scan on theaters_distributors_recent_activity ra_1 (cost=0.00..42.75 rows=660 width=8) (never executed)

  • Filter: (((distributor_id)::text = ANY ('{TESTDIST1,TESTDIST2}'::text[])) AND (most_recent_submission >= (now() - ('90 DAYS'::cstring)::interval)))
Planning time : 15.563 ms
Execution time : 3.078 ms