explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vkMb

Settings
# exclusive inclusive rows x rows loops node
1. 13.656 378.696 ↑ 175.5 4,245 1

GroupAggregate (cost=77,658,926.84..78,593,615.48 rows=744,846 width=508) (actual time=362.747..378.696 rows=4,245 loops=1)

  • Group Key: th.id
2.          

CTE contacted_theaters_cte

3. 0.394 9.771 ↑ 6.4 39 1

GroupAggregate (cost=1,625.95..1,685.81 rows=249 width=50) (actual time=9.337..9.771 rows=39 loops=1)

  • Group Key: ct_1.theater_id
4. 0.269 9.377 ↑ 13.9 273 1

Sort (cost=1,625.95..1,635.41 rows=3,783 width=82) (actual time=9.260..9.377 rows=273 loops=1)

  • Sort Key: ct_1.theater_id
  • Sort Method: quicksort Memory: 46kB
5. 0.268 9.108 ↑ 13.9 273 1

Hash Join (cost=85.77..1,401.14 rows=3,783 width=82) (actual time=3.245..9.108 rows=273 loops=1)

  • Hash Cond: (ct_1.user_id = us.id)
6. 5.862 5.862 ↓ 1.0 273 1

Seq Scan on data_recovery_contacted_theaters ct_1 (cost=0.00..1,182.42 rows=267 width=26) (actual time=0.254..5.862 rows=273 loops=1)

  • Filter: ((contacted_date >= '2017-10-20'::date) AND (contacted_date <= '2017-10-26'::date))
  • Rows Removed by Filter: 47822
7. 1.556 2.978 ↑ 1.0 2,834 1

Hash (cost=50.34..50.34 rows=2,834 width=72) (actual time=2.978..2.978 rows=2,834 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 218kB
8. 1.422 1.422 ↑ 1.0 2,834 1

Seq Scan on decrypted_users us (cost=0.00..50.34 rows=2,834 width=72) (actual time=0.009..1.422 rows=2,834 loops=1)

9. 8.028 365.040 ↑ 2,014.2 5,240 1

Sort (cost=77,657,241.03..77,683,627.20 rows=10,554,468 width=270) (actual time=362.727..365.040 rows=5,240 loops=1)

  • Sort Key: th.id
  • Sort Method: quicksort Memory: 1526kB
10. 9.550 357.012 ↑ 2,014.2 5,240 1

Nested Loop Left Join (cost=74,825,482.58..75,091,220.57 rows=10,554,468 width=270) (actual time=333.821..357.012 rows=5,240 loops=1)

  • Join Filter: false
11. 6.201 347.462 ↑ 2,014.2 5,240 1

Merge Right Join (cost=74,825,482.58..74,985,675.89 rows=10,554,468 width=270) (actual time=333.817..347.462 rows=5,240 loops=1)

  • Merge Cond: (nu.id = mg.user_id)
12. 2.432 3.838 ↑ 6.0 472 1

Sort (cost=212.85..219.94 rows=2,834 width=72) (actual time=3.592..3.838 rows=472 loops=1)

  • Sort Key: nu.id
  • Sort Method: quicksort Memory: 323kB
13. 1.406 1.406 ↑ 1.0 2,834 1

Seq Scan on decrypted_users nu (cost=0.00..50.34 rows=2,834 width=72) (actual time=0.006..1.406 rows=2,834 loops=1)

14. 4.804 337.423 ↑ 142.1 5,240 1

Materialize (cost=74,825,269.73..74,828,993.96 rows=744,846 width=214) (actual time=330.202..337.423 rows=5,240 loops=1)

15. 7.877 332.619 ↑ 142.1 5,240 1

Sort (cost=74,825,269.73..74,827,131.85 rows=744,846 width=214) (actual time=330.198..332.619 rows=5,240 loops=1)

  • Sort Key: mg.user_id
  • Sort Method: quicksort Memory: 1538kB
16. 8.946 324.742 ↑ 142.1 5,240 1

Nested Loop Left Join (cost=74,543,959.84..74,676,245.73 rows=744,846 width=214) (actual time=255.069..324.742 rows=5,240 loops=1)

17. 5.242 305.316 ↑ 142.1 5,240 1

Merge Left Join (cost=74,543,959.70..74,555,238.10 rows=744,846 width=205) (actual time=255.042..305.316 rows=5,240 loops=1)

  • Merge Cond: (th.id = mg.theater_id)
18. 4.900 298.554 ↑ 143.8 5,179 1

Merge Left Join (cost=74,543,627.33..74,553,043.27 rows=744,846 width=185) (actual time=253.568..298.554 rows=5,179 loops=1)

  • Merge Cond: (th.id = ct.theater_id)
19. 12.252 283.768 ↑ 143.8 5,179 1

Merge Left Join (cost=74,543,612.44..74,551,164.87 rows=744,846 width=143) (actual time=243.716..283.768 rows=5,179 loops=1)

  • Merge Cond: (th.id = id.theater_id)
20. 7.865 246.090 ↑ 143.8 5,179 1

Merge Left Join (cost=74,537,118.14..74,542,730.03 rows=744,846 width=136) (actual time=224.707..246.090 rows=5,179 loops=1)

  • Merge Cond: (th.id = ta.theater_id)
21. 6.874 222.307 ↑ 155.5 4,791 1

Merge Left Join (cost=74,532,819.21..74,536,564.92 rows=744,846 width=136) (actual time=211.401..222.307 rows=4,791 loops=1)

  • Merge Cond: (th.id = dj.theater_id)
22. 6.266 124.892 ↑ 175.5 4,245 1

Sort (cost=74,515,535.20..74,517,397.32 rows=744,846 width=114) (actual time=122.727..124.892 rows=4,245 loops=1)

  • Sort Key: th.id
  • Sort Method: quicksort Memory: 929kB
23. 4.489 118.626 ↑ 175.5 4,245 1

Hash Left Join (cost=62,171.30..74,397,062.70 rows=744,846 width=114) (actual time=44.823..118.626 rows=4,245 loops=1)

  • Hash Cond: (th.circuit_id = ci.id)
24. 84.025 106.464 ↑ 175.5 4,245 1

Bitmap Heap Scan on theaters th (cost=61,979.47..74,387,468.24 rows=744,846 width=93) (actual time=37.097..106.464 rows=4,245 loops=1)

  • Recheck Cond: ((country_id)::text = 'US'::text)
  • Filter: (alternatives: SubPlan 2 or hashed SubPlan 3)
  • Rows Removed by Filter: 8169
  • Heap Blocks: exact=25651
25. 13.893 13.893 ↑ 12.3 120,664 1

Bitmap Index Scan on ix_theaters_country_49 (cost=0.00..61,793.26 rows=1,489,693 width=0) (actual time=13.893..13.893 rows=120,664 loops=1)

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

SubPlan (for Bitmap Heap Scan)

27. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_theater_aliases_theater_id on theater_aliases ta_1 (cost=0.42..49.44 rows=1 width=0) (never executed)

  • Index Cond: (theater_id = th.id)
  • Filter: ((source_id)::text = ANY ('{AMC,AGILE,ALAMODRAFTHOUSE,ALLURE,AZTECADELRIOBRAVO,BNB,BONNERMALL,CMX,CAPRITHEATRE,CARIBBEANCINEMAS,CENTEREDGE,CINELEO,CINECENTRE,CINEMACOLIBRI,CINEMAPARAMOUNT,CINEMAGIC,CINEMAGIC-USA,CINEMARK,CINEMARK-PERU,CINEMASDELCOUNTRY,CINEMASHENRY,CINEMEX,CINEPLANET,CINEPOLIS,CINEPOLISPERU,CINERAMA,CINESTAR,CITICINEMAS,COBB-IMPORT,EMS,EASYWARE,EXHIBIDORADELBRAVO,FILMBOT,FINO,HARKINS,KWIC,LANDMARK,LIMELIGHT,LOEKS,LOOKCINEMAS,MJR,MALCO,MANUAL-ENTRY,MARCUS,MARQUEE,MAYA,MOVIEHEROES,NCSOFTWARE,NATIONALAMUSEMENTS,OCEANCINEMAS,OMNITERM,OMNITERM-ALT,ORPHEUM,PACIFIC,PACIFIC-VISTA,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[]))
28. 7.107 8.546 ↑ 1.1 6,535 1

Bitmap Heap Scan on theater_aliases ta_2 (cost=420.97..6,354.36 rows=7,502 width=8) (actual time=1.543..8.546 rows=6,535 loops=1)

  • Recheck Cond: ((source_id)::text = ANY ('{AMC,AGILE,ALAMODRAFTHOUSE,ALLURE,AZTECADELRIOBRAVO,BNB,BONNERMALL,CMX,CAPRITHEATRE,CARIBBEANCINEMAS,CENTEREDGE,CINELEO,CINECENTRE,CINEMACOLIBRI,CINEMAPARAMOUNT,CINEMAGIC,CINEMAGIC-USA,CINEMARK,CINEMARK-PERU,CINEMASDELCOUNTRY,CINEMASHENRY,CINEMEX,CINEPLANET,CINEPOLIS,CINEPOLISPERU,CINERAMA,CINESTAR,CITICINEMAS,COBB-IMPORT,EMS,EASYWARE,EXHIBIDORADELBRAVO,FILMBOT,FINO,HARKINS,KWIC,LANDMARK,LIMELIGHT,LOEKS,LOOKCINEMAS,MJR,MALCO,MANUAL-ENTRY,MARCUS,MARQUEE,MAYA,MOVIEHEROES,NCSOFTWARE,NATIONALAMUSEMENTS,OCEANCINEMAS,OMNITERM,OMNITERM-ALT,ORPHEUM,PACIFIC,PACIFIC-VISTA,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[]))
  • Heap Blocks: exact=1000
29. 1.439 1.439 ↑ 1.1 6,537 1

Bitmap Index Scan on ix_theater_aliases_source_id (cost=0.00..419.09 rows=7,502 width=0) (actual time=1.439..1.439 rows=6,537 loops=1)

  • Index Cond: ((source_id)::text = ANY ('{AMC,AGILE,ALAMODRAFTHOUSE,ALLURE,AZTECADELRIOBRAVO,BNB,BONNERMALL,CMX,CAPRITHEATRE,CARIBBEANCINEMAS,CENTEREDGE,CINELEO,CINECENTRE,CINEMACOLIBRI,CINEMAPARAMOUNT,CINEMAGIC,CINEMAGIC-USA,CINEMARK,CINEMARK-PERU,CINEMASDELCOUNTRY,CINEMASHENRY,CINEMEX,CINEPLANET,CINEPOLIS,CINEPOLISPERU,CINERAMA,CINESTAR,CITICINEMAS,COBB-IMPORT,EMS,EASYWARE,EXHIBIDORADELBRAVO,FILMBOT,FINO,HARKINS,KWIC,LANDMARK,LIMELIGHT,LOEKS,LOOKCINEMAS,MJR,MALCO,MANUAL-ENTRY,MARCUS,MARQUEE,MAYA,MOVIEHEROES,NCSOFTWARE,NATIONALAMUSEMENTS,OCEANCINEMAS,OMNITERM,OMNITERM-ALT,ORPHEUM,PACIFIC,PACIFIC-VISTA,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[]))
30. 3.929 7.673 ↑ 1.0 6,259 1

Hash (cost=113.59..113.59 rows=6,259 width=29) (actual time=7.673..7.673 rows=6,259 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 445kB
31. 3.744 3.744 ↑ 1.0 6,259 1

Seq Scan on circuits ci (cost=0.00..113.59 rows=6,259 width=29) (actual time=0.012..3.744 rows=6,259 loops=1)

32. 4.580 90.541 ↓ 1.0 4,013 1

Sort (cost=17,284.00..17,293.61 rows=3,844 width=30) (actual time=88.666..90.541 rows=4,013 loops=1)

  • Sort Key: dj.theater_id
  • Sort Method: quicksort Memory: 411kB
33. 4.206 85.961 ↓ 1.0 4,013 1

Hash Left Join (cost=1.99..17,055.12 rows=3,844 width=30) (actual time=17.265..85.961 rows=4,013 loops=1)

  • Hash Cond: (dj.justification_id = (ju.id)::text)
34. 81.697 81.697 ↓ 1.0 4,013 1

Seq Scan on data_recovery_justifications dj (cost=0.00..17,005.38 rows=3,844 width=14) (actual time=17.191..81.697 rows=4,013 loops=1)

  • Filter: ((booking_date >= '2017-10-20'::date) AND (booking_date <= '2017-10-26'::date))
  • Rows Removed by Filter: 784709
35. 0.028 0.058 ↑ 1.0 44 1

Hash (cost=1.44..1.44 rows=44 width=18) (actual time=0.058..0.058 rows=44 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
36. 0.030 0.030 ↑ 1.0 44 1

Seq Scan on justifications ju (cost=0.00..1.44 rows=44 width=18) (actual time=0.006..0.030 rows=44 loops=1)

37. 6.006 15.918 ↓ 7.5 5,501 1

Sort (cost=4,298.92..4,300.75 rows=731 width=8) (actual time=13.284..15.918 rows=5,501 loops=1)

  • Sort Key: ta.theater_id
  • Sort Method: quicksort Memory: 457kB
38. 4.562 9.912 ↓ 8.2 6,018 1

Bitmap Heap Scan on theater_aliases ta (cost=2,222.25..4,264.15 rows=731 width=8) (actual time=5.457..9.912 rows=6,018 loops=1)

  • Recheck Cond: (((source_id)::text = ANY ('{AMC,AGILE,ALAMODRAFTHOUSE,ALLURE,AZTECADELRIOBRAVO,BNB,BONNERMALL,CMX,CAPRITHEATRE,CARIBBEANCINEMAS,CENTEREDGE,CINELEO,CINECENTRE,CINEMACOLIBRI,CINEMAPARAMOUNT,CINEMAGIC,CINEMAGIC-USA,CINEMARK,CINEMARK-PERU,CINEMASDELCOUNTRY,CINEMASHENRY,CINEMEX,CINEPLANET,CINEPOLIS,CINEPOLISPERU,CINERAMA,CINESTAR,CITICINEMAS,COBB-IMPORT,EMS,EASYWARE,EXHIBIDORADELBRAVO,FILMBOT,FINO,HARKINS,KWIC,LANDMARK,LIMELIGHT,LOEKS,LOOKCINEMAS,MJR,MALCO,MANUAL-ENTRY,MARCUS,MARQUEE,MAYA,MOVIEHEROES,NCSOFTWARE,NATIONALAMUSEMENTS,OCEANCINEMAS,OMNITERM,OMNITERM-ALT,ORPHEUM,PACIFIC,PACIFIC-VISTA,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[])) AND (source_type = 'EXT'::text))
  • Heap Blocks: exact=955
39. 0.042 5.350 ↓ 0.0 0 1

BitmapAnd (cost=2,222.25..2,222.25 rows=731 width=0) (actual time=5.350..5.350 rows=0 loops=1)

40. 1.094 1.094 ↑ 1.1 6,537 1

Bitmap Index Scan on ix_theater_aliases_source_id (cost=0.00..419.09 rows=7,502 width=0) (actual time=1.094..1.094 rows=6,537 loops=1)

  • Index Cond: ((source_id)::text = ANY ('{AMC,AGILE,ALAMODRAFTHOUSE,ALLURE,AZTECADELRIOBRAVO,BNB,BONNERMALL,CMX,CAPRITHEATRE,CARIBBEANCINEMAS,CENTEREDGE,CINELEO,CINECENTRE,CINEMACOLIBRI,CINEMAPARAMOUNT,CINEMAGIC,CINEMAGIC-USA,CINEMARK,CINEMARK-PERU,CINEMASDELCOUNTRY,CINEMASHENRY,CINEMEX,CINEPLANET,CINEPOLIS,CINEPOLISPERU,CINERAMA,CINESTAR,CITICINEMAS,COBB-IMPORT,EMS,EASYWARE,EXHIBIDORADELBRAVO,FILMBOT,FINO,HARKINS,KWIC,LANDMARK,LIMELIGHT,LOEKS,LOOKCINEMAS,MJR,MALCO,MANUAL-ENTRY,MARCUS,MARQUEE,MAYA,MOVIEHEROES,NCSOFTWARE,NATIONALAMUSEMENTS,OCEANCINEMAS,OMNITERM,OMNITERM-ALT,ORPHEUM,PACIFIC,PACIFIC-VISTA,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[]))
41. 4.214 4.214 ↑ 1.0 35,309 1

Bitmap Index Scan on ix_theater_aliases_source_type (cost=0.00..1,802.54 rows=35,482 width=0) (actual time=4.214..4.214 rows=35,309 loops=1)

  • Index Cond: (source_type = 'EXT'::text)
42. 15.935 25.426 ↓ 1.0 14,783 1

Sort (cost=6,494.26..6,529.52 rows=14,106 width=15) (actual time=19.004..25.426 rows=14,783 loops=1)

  • Sort Key: id.theater_id
  • Sort Method: quicksort Memory: 1034kB
43. 8.631 9.491 ↑ 1.0 13,860 1

Bitmap Heap Scan on theater_aliases id (cost=485.74..5,522.07 rows=14,106 width=15) (actual time=0.918..9.491 rows=13,860 loops=1)

  • Recheck Cond: ((source_id)::text = 'BOE'::text)
  • Heap Blocks: exact=381
44. 0.860 0.860 ↑ 1.0 13,860 1

Bitmap Index Scan on ix_theater_aliases_source_id (cost=0.00..482.22 rows=14,106 width=0) (actual time=0.860..0.860 rows=13,860 loops=1)

  • Index Cond: ((source_id)::text = 'BOE'::text)
45. 0.067 9.886 ↑ 5.4 46 1

Sort (cost=14.89..15.51 rows=249 width=50) (actual time=9.848..9.886 rows=46 loops=1)

  • Sort Key: ct.theater_id
  • Sort Method: quicksort Memory: 28kB
46. 9.819 9.819 ↑ 6.4 39 1

CTE Scan on contacted_theaters_cte ct (cost=0.00..4.98 rows=249 width=50) (actual time=9.341..9.819 rows=39 loops=1)

47. 0.081 1.520 ↓ 1.7 105 1

Sort (cost=332.37..332.53 rows=62 width=28) (actual time=1.471..1.520 rows=105 loops=1)

  • Sort Key: mg.theater_id
  • Sort Method: quicksort Memory: 29kB
48. 1.439 1.439 ↑ 1.2 53 1

Seq Scan on data_recovery_mg_ignored_dates mg (cost=0.00..330.52 rows=62 width=28) (actual time=0.908..1.439 rows=53 loops=1)

  • Filter: ((ignored_date >= '2017-10-20'::date) AND (ignored_date <= '2017-10-26'::date))
  • Rows Removed by Filter: 13382
49. 10.480 10.480 ↑ 1.0 1 5,240

Index Scan using pk_states on states s (cost=0.14..0.16 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=5,240)

  • Index Cond: (((id)::text = (th.state_id)::text) AND ((country_id)::text = (th.country_id)::text) AND ((country_id)::text = 'US'::text))
50. 0.000 0.000 ↓ 0.0 0 5,240

Result (cost=0.00..0.00 rows=0 width=0) (actual time=0.000..0.000 rows=0 loops=5,240)

  • One-Time Filter: false