explain.depesz.com

PostgreSQL's explain analyze made readable

Result: msWM

Settings
# exclusive inclusive rows x rows loops node
1. 0.031 1,867.062 ↑ 1.0 100 1

Limit (cost=1,153.11..11,799.36 rows=100 width=20) (actual time=1,590.636..1,867.062 rows=100 loops=1)

2. 1.491 1,867.031 ↑ 61.5 100 1

Nested Loop Anti Join (cost=1,153.11..656,216.55 rows=6,153 width=20) (actual time=1,590.634..1,867.031 rows=100 loops=1)

  • Join Filter: (eslq1.event_id = ce1.id)
  • Rows Removed by Join Filter: 14600
3. 433.152 1,864.340 ↑ 61.5 100 1

Nested Loop (cost=1,152.86..656,121.98 rows=6,153 width=20) (actual time=1,590.352..1,864.340 rows=100 loops=1)

  • Join Filter: (c1.id = v1.cinema_id)
  • Rows Removed by Join Filter: 4201430
4. 3.255 1,177.142 ↑ 14.6 9,771 1

Nested Loop (cost=1.26..579,637.73 rows=142,913 width=24) (actual time=125.625..1,177.142 rows=9,771 loops=1)

5. 20.395 1,154.345 ↑ 14.6 9,771 1

Nested Loop (cost=0.98..536,309.64 rows=142,913 width=24) (actual time=125.614..1,154.345 rows=9,771 loops=1)

6. 895.156 895.156 ↑ 4.8 39,799 1

Index Scan using current_event_event_seating_asked_at_idx on current_event ce1 (cost=0.55..323,670.91 rows=191,090 width=28) (actual time=0.032..895.156 rows=39,799 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: 337506
7. 238.794 238.794 ↓ 0.0 0 39,799

Index Scan using event_pkey on event e1 (cost=0.43..1.10 rows=1 width=22) (actual time=0.006..0.006 rows=0 loops=39,799)

  • 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
8. 19.542 19.542 ↑ 1.0 1 9,771

Index Scan using venue_pkey on venue v1 (cost=0.28..0.30 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=9,771)

  • Index Cond: (id = e1.venue_id)
9. 248.046 254.046 ↓ 12.3 430 9,771

Materialize (cost=1,151.60..1,455.01 rows=35 width=8) (actual time=0.000..0.026 rows=430 loops=9,771)

10. 0.146 6.000 ↓ 12.3 430 1

Nested Loop (cost=1,151.60..1,454.84 rows=35 width=8) (actual time=3.937..6.000 rows=430 loops=1)

11. 0.232 4.222 ↓ 4.1 816 1

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

12. 0.292 3.990 ↑ 1.3 836 1

Sort (cost=1,151.32..1,154.08 rows=1,103 width=12) (actual time=3.924..3.990 rows=836 loops=1)

  • Sort Key: "*SELECT* 1".cinema_id, ((0)::bigint) DESC
  • Sort Method: quicksort Memory: 64kB
13. 0.426 3.698 ↑ 1.3 836 1

HashAggregate (cost=1,073.52..1,084.55 rows=1,103 width=12) (actual time=3.533..3.698 rows=836 loops=1)

  • Group Key: "*SELECT* 1".cinema_id, ((0)::bigint)
14. 0.086 3.272 ↑ 1.3 836 1

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

15. 0.151 0.445 ↑ 1.0 816 1

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

16. 0.294 0.294 ↑ 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.007..0.294 rows=816 loops=1)

  • Heap Fetches: 66
17. 0.044 2.741 ↑ 14.3 20 1

HashAggregate (cost=970.04..972.91 rows=287 width=12) (actual time=2.734..2.741 rows=20 loops=1)

  • Group Key: e1_1.cinema_id
18. 0.091 2.697 ↑ 2.7 108 1

Nested Loop (cost=0.85..968.60 rows=287 width=4) (actual time=0.042..2.697 rows=108 loops=1)

19. 1.850 1.850 ↑ 2.7 108 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.025..1.850 rows=108 loops=1)

  • Index Cond: (ended_at IS NULL)
20. 0.756 0.756 ↑ 1.0 1 108

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

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

Index Scan using cinema_pkey on cinema c1 (cost=0.28..1.47 rows=1 width=8) (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
22. 0.967 1.200 ↓ 146.0 146 100

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

23. 0.233 0.233 ↓ 146.0 146 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.052..0.233 rows=146 loops=1)

  • Heap Fetches: 453
Planning time : 2.328 ms
Execution time : 1,867.248 ms