explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xAAE

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 5,273.841 ↑ 25.0 4 1

Limit (cost=1,153.11..25,961.86 rows=100 width=20) (actual time=5,220.429..5,273.841 rows=4 loops=1)

2. 0.006 5,273.838 ↑ 512.8 4 1

Nested Loop Anti Join (cost=1,153.11..509,980.59 rows=2,051 width=20) (actual time=5,220.427..5,273.838 rows=4 loops=1)

  • Join Filter: (eslq1.event_id = ce1.id)
3. 14.303 5,273.784 ↑ 512.8 4 1

Nested Loop (cost=1,152.86..509,947.55 rows=2,051 width=20) (actual time=5,220.376..5,273.784 rows=4 loops=1)

4. 2,514.114 5,117.531 ↓ 10.3 28,390 1

Nested Loop (cost=1,152.43..506,895.56 rows=2,743 width=28) (actual time=5.975..5,117.531 rows=28,390 loops=1)

  • Join Filter: ((ce1.consecutive_unsuccessful_event_seating_lookup_count < c1.maximum_consecutive_unsuccessful_event_seating_lookup_count) AND (v1.cinema_id = c1.id))
  • Rows Removed by Join Filter: 17110980
5. 25.504 1,567.083 ↑ 4.8 39,859 1

Nested Loop (cost=0.83..388,356.35 rows=191,158 width=36) (actual time=0.062..1,567.083 rows=39,859 loops=1)

6. 1,461.861 1,461.861 ↑ 4.8 39,859 1

Index Scan using current_event_event_seating_asked_at_idx on current_event ce1 (cost=0.55..323,670.91 rows=191,158 width=36) (actual time=0.049..1,461.861 rows=39,859 loops=1)

  • Filter: ((event_seating_updated_at IS NOT NULL) AND (unrecoverable_error IS NULL) AND (start_time > now()) AND (CASE WHEN ((last_event_seating_asked_at < (now() - '00:05:00'::interval)) AND (start_time < (now() + '00:15:00'::interval))) THEN 'NEXT_IMMEDIATE'::text WHEN ((last_event_seating_asked_at < (now() - '00:10:00'::interval)) AND (start_time < (now() + '01:00:00'::interval))) THEN 'NEXT_HOUR'::text WHEN ((last_event_seating_asked_at < (now() - '03:00:00'::interval)) AND (start_time < (now() + '1 day'::interval))) THEN 'NEXT_DAY'::text WHEN ((last_event_seating_asked_at < (now() - '06:00:00'::interval)) AND (start_time < (now() + '7 days'::interval))) THEN 'NEXT_WEEK'::text WHEN ((last_event_seating_asked_at < (now() - '06:00:00'::interval)) AND (start_time < (now() + '1 mon'::interval))) THEN 'NEXT_MONTH'::text WHEN (last_event_seating_asked_at < (now() - '12:00:00'::interval)) THEN 'NEXT_FUTURE'::text ELSE NULL::text END IS NOT NULL) AND ((consecutive_unsuccessful_event_seating_lookup_count = 0) OR (last_event_seating_asked_at < (now() - ('00:00:01'::interval * (bound_power((consecutive_unsuccessful_event_seating_lookup_count + 1), 4, 1, 1440))::double precision)))))
  • Rows Removed by Filter: 499054
7. 79.718 79.718 ↑ 1.0 1 39,859

Index Scan using venue_pkey on venue v1 (cost=0.28..0.34 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=39,859)

  • Index Cond: (id = ce1.venue_id)
8. 1,030.436 1,036.334 ↓ 12.3 430 39,859

Materialize (cost=1,151.60..1,455.01 rows=35 width=12) (actual time=0.000..0.026 rows=430 loops=39,859)

9. 0.679 5.898 ↓ 12.3 430 1

Nested Loop (cost=1,151.60..1,454.84 rows=35 width=12) (actual time=3.269..5.898 rows=430 loops=1)

10. 0.231 3.587 ↓ 4.1 816 1

Unique (cost=1,151.32..1,156.84 rows=200 width=12) (actual time=3.256..3.587 rows=816 loops=1)

11. 0.306 3.356 ↑ 1.3 823 1

Sort (cost=1,151.32..1,154.08 rows=1,103 width=12) (actual time=3.255..3.356 rows=823 loops=1)

  • Sort Key: "*SELECT* 1".cinema_id, ((0)::bigint) DESC
  • Sort Method: quicksort Memory: 63kB
12. 0.400 3.050 ↑ 1.3 823 1

HashAggregate (cost=1,073.52..1,084.55 rows=1,103 width=12) (actual time=2.865..3.050 rows=823 loops=1)

  • Group Key: "*SELECT* 1".cinema_id, ((0)::bigint)
13. 0.086 2.650 ↑ 1.3 823 1

Append (cost=0.28..1,068.01 rows=1,103 width=12) (actual time=0.010..2.650 rows=823 loops=1)

14. 0.138 0.500 ↑ 1.0 816 1

Subquery Scan on *SELECT* 1 (cost=0.28..86.72 rows=816 width=12) (actual time=0.010..0.500 rows=816 loops=1)

15. 0.362 0.362 ↑ 1.0 816 1

Index Only Scan using cinema_pkey on cinema c1_1 (cost=0.28..76.52 rows=816 width=8) (actual time=0.009..0.362 rows=816 loops=1)

  • Heap Fetches: 66
16. 0.022 2.064 ↑ 41.0 7 1

HashAggregate (cost=970.04..972.91 rows=287 width=12) (actual time=2.060..2.064 rows=7 loops=1)

  • Group Key: e1_1.cinema_id
17. 0.010 2.042 ↑ 9.9 29 1

Nested Loop (cost=0.85..968.60 rows=287 width=4) (actual time=0.039..2.042 rows=29 loops=1)

18. 1.771 1.771 ↑ 9.9 29 1

Index Scan using event_seating_lookup_ended_at_idx on event_seating_lookup esl1 (cost=0.42..268.17 rows=287 width=4) (actual time=0.019..1.771 rows=29 loops=1)

  • Index Cond: (ended_at IS NULL)
19. 0.261 0.261 ↑ 1.0 1 29

Index Scan using event_pkey on event e1_1 (cost=0.43..2.44 rows=1 width=8) (actual time=0.009..0.009 rows=1 loops=29)

  • Index Cond: (id = esl1.event_id)
20. 1.632 1.632 ↑ 1.0 1 816

Index Scan using cinema_pkey on cinema c1 (cost=0.28..1.47 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=816)

  • Index Cond: (id = "*SELECT* 1".cinema_id)
  • Filter: ((data_aggregation_disabled_at IS NULL) AND (((0)::bigint) < maximum_event_seating_lookup_concurrency))
  • Rows Removed by Filter: 0
21. 141.950 141.950 ↓ 0.0 0 28,390

Index Scan using event_pkey on event e1 (cost=0.43..1.10 rows=1 width=18) (actual time=0.005..0.005 rows=0 loops=28,390)

  • Index Cond: (id = ce1.id)
  • Filter: ((auditorium_id IS NOT NULL) AND (timezone_name IS NOT NULL) AND (unlisted_at IS NULL) AND (((to_char(timezone(timezone_name, now()), 'HH24'::text))::smallint < 0) OR ((to_char(timezone(timezone_name, now()), 'HH24'::text))::smallint > 7) OR (ce1.created_at > (now() - '24:00:00'::interval)) OR (ce1.start_time < (now() + '24:00:00'::interval))))
  • Rows Removed by Filter: 1
22. 0.003 0.048 ↓ 0.0 0 4

Materialize (cost=0.25..2.27 rows=1 width=4) (actual time=0.012..0.012 rows=0 loops=4)

23. 0.045 0.045 ↓ 0.0 0 1

Index Only Scan using event_seating_lookup_queue_event_id_idx on event_seating_lookup_queue eslq1 (cost=0.25..2.27 rows=1 width=4) (actual time=0.045..0.045 rows=0 loops=1)

  • Heap Fetches: 4
Planning time : 3.124 ms
Execution time : 5,274.121 ms