explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Ffv

Settings
# exclusive inclusive rows x rows loops node
1. 0.031 2,305.140 ↑ 1.1 91 1

Limit (cost=961.14..43,842.30 rows=100 width=20) (actual time=162.676..2,305.140 rows=91 loops=1)

2. 0.101 2,305.109 ↑ 8.1 91 1

Nested Loop Anti Join (cost=961.14..317,852.91 rows=739 width=20) (actual time=162.675..2,305.109 rows=91 loops=1)

3. 741.824 2,304.735 ↑ 8.1 91 1

Nested Loop (cost=960.88..317,642.08 rows=739 width=20) (actual time=162.664..2,304.735 rows=91 loops=1)

  • Join Filter: ((ce1.consecutive_unsuccessful_event_seating_lookup_count < c1.maximum_consecutive_unsuccessful_event_seating_lookup_count) AND (e1.cinema_id = c1.id))
  • Rows Removed by Join Filter: 4169991
4. 30.191 1,230.867 ↑ 5.3 9,766 1

Nested Loop (cost=0.85..284,846.91 rows=51,481 width=28) (actual time=0.447..1,230.867 rows=9,766 loops=1)

5. 921.866 921.866 ↑ 1.7 39,830 1

Index Scan using current_event_start_time_event_seating_asked_at_idx on current_event ce1 (cost=0.42..183,477.81 rows=69,039 width=32) (actual time=0.051..921.866 rows=39,830 loops=1)

  • Index Cond: (start_time > now())
  • Filter: ((event_seating_updated_at IS NOT NULL) AND (unrecoverable_error IS NULL) 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 (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: 205395
6. 278.810 278.810 ↓ 0.0 0 39,830

Index Scan using event_pkey on event e1 (cost=0.43..1.46 rows=1 width=22) (actual time=0.007..0.007 rows=0 loops=39,830)

  • 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
7. 321.631 332.044 ↓ 12.2 427 9,766

Materialize (cost=960.02..1,263.15 rows=35 width=12) (actual time=0.001..0.034 rows=427 loops=9,766)

8. 0.168 10.413 ↓ 12.2 427 1

Nested Loop (cost=960.02..1,262.97 rows=35 width=12) (actual time=8.353..10.413 rows=427 loops=1)

9. 0.198 8.613 ↓ 4.1 816 1

Unique (cost=959.75..964.97 rows=200 width=12) (actual time=8.343..8.613 rows=816 loops=1)

10. 0.288 8.415 ↑ 1.2 875 1

Sort (cost=959.75..962.36 rows=1,045 width=12) (actual time=8.341..8.415 rows=875 loops=1)

  • Sort Key: "*SELECT* 1".cinema_id, ((0)::bigint) DESC
  • Sort Method: quicksort Memory: 66kB
11. 0.387 8.127 ↑ 1.2 875 1

HashAggregate (cost=886.45..896.90 rows=1,045 width=12) (actual time=7.956..8.127 rows=875 loops=1)

  • Group Key: "*SELECT* 1".cinema_id, ((0)::bigint)
12. 0.099 7.740 ↑ 1.2 875 1

Append (cost=0.28..881.22 rows=1,045 width=12) (actual time=0.007..7.740 rows=875 loops=1)

13. 0.134 0.429 ↑ 1.0 816 1

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

14. 0.295 0.295 ↑ 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.006..0.295 rows=816 loops=1)

  • Heap Fetches: 67
15. 0.146 7.212 ↑ 3.9 59 1

HashAggregate (cost=784.70..786.99 rows=229 width=12) (actual time=7.198..7.212 rows=59 loops=1)

  • Group Key: e1_1.cinema_id
16. 0.306 7.066 ↓ 1.7 397 1

Nested Loop (cost=0.85..783.56 rows=229 width=4) (actual time=0.059..7.066 rows=397 loops=1)

17. 3.981 3.981 ↓ 1.7 397 1

Index Scan using event_seating_lookup_ended_at_idx on event_seating_lookup esl1 (cost=0.42..224.08 rows=229 width=4) (actual time=0.044..3.981 rows=397 loops=1)

  • Index Cond: (ended_at IS NULL)
18. 2.779 2.779 ↑ 1.0 1 397

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=397)

  • Index Cond: (id = esl1.event_id)
19. 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
20. 0.273 0.273 ↓ 0.0 0 91

Index Only Scan using event_seating_lookup_queue_event_id_idx on event_seating_lookup_queue eslq1 (cost=0.27..0.29 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=91)

  • Index Cond: (event_id = ce1.id)
  • Heap Fetches: 0
Planning time : 2.269 ms
Execution time : 2,305.333 ms