explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Duyv

Settings
# exclusive inclusive rows x rows loops node
1. 0.610 58,194.024 ↓ 799.0 799 1

Unique (cost=2,953.35..2,953.38 rows=1 width=161) (actual time=58,193.172..58,194.024 rows=799 loops=1)

2. 5.419 58,193.414 ↓ 1,293.0 1,293 1

Sort (cost=2,953.35..2,953.36 rows=1 width=161) (actual time=58,193.170..58,193.414 rows=1,293 loops=1)

  • Sort Key: users.email, ticket_owner_consent.user_id, ticket_owner_consent.consent_request_id, ticket_owner_consent.created, ticket_owner_consent.expires, ticket_owner_consent.purchase_id, consent_req
  • Sort Method: quicksort Memory: 329kB
3. 3.048 58,187.995 ↓ 1,293.0 1,293 1

Nested Loop (cost=5.29..2,953.34 rows=1 width=161) (actual time=118.644..58,187.995 rows=1,293 loops=1)

4. 906.494 58,177.189 ↓ 1,293.0 1,293 1

Nested Loop (cost=4.86..2,952.84 rows=1 width=147) (actual time=118.621..58,177.189 rows=1,293 loops=1)

  • Join Filter: (ticket_owner_consent.user_id = purchases.user_id)
  • Rows Removed by Join Filter: 4,336,671
5. 5.130 22.559 ↓ 1,476.0 1,476 1

Nested Loop (cost=1.44..351.13 rows=1 width=16) (actual time=0.031..22.559 rows=1,476 loops=1)

6. 2.012 5.621 ↓ 1,476.0 1,476 1

Nested Loop (cost=1.01..349.06 rows=1 width=16) (actual time=0.024..5.621 rows=1,476 loops=1)

7. 0.003 0.015 ↑ 1.0 1 1

Nested Loop (cost=0.58..5.29 rows=1 width=16) (actual time=0.013..0.015 rows=1 loops=1)

8. 0.008 0.008 ↑ 1.0 1 1

Index Scan using events_pkey on events (cost=0.29..2.31 rows=1 width=16) (actual time=0.007..0.008 rows=1 loops=1)

  • Index Cond: (event_id = '3907656401'::bigint)
9. 0.004 0.004 ↑ 1.0 1 1

Index Scan using event_types_pkey on event_types (cost=0.29..2.31 rows=1 width=16) (actual time=0.004..0.004 rows=1 loops=1)

  • Index Cond: (event_type_id = events.event_type_id)
  • Filter: (organization_id = 557,857,847)
10. 3.594 3.594 ↑ 4.5 1,476 1

Index Scan using reserved_or_sold_tickets on tickets (cost=0.43..277.49 rows=6,628 width=16) (actual time=0.010..3.594 rows=1,476 loops=1)

  • Index Cond: (event_id = '3907656401'::bigint)
11. 11.808 11.808 ↑ 1.0 1 1,476

Index Scan using purchases_pkey on purchases (cost=0.43..2.07 rows=1 width=16) (actual time=0.008..0.008 rows=1 loops=1,476)

  • Index Cond: (purchase_id = tickets.purchase_id)
  • Filter: (finalized IS NOT NULL)
12. 24,356.933 57,248.136 ↓ 4.5 2,939 1,476

Hash Join (cost=3.43..2,593.53 rows=655 width=147) (actual time=0.004..38.786 rows=2,939 loops=1,476)

  • Hash Cond: (ticket_owner_consent.consent_request_id = consent_requests.consent_request_id)
13. 32,891.184 32,891.184 ↑ 1.0 72,649 1,476

Seq Scan on ticket_owner_consent (cost=0.00..2,397.69 rows=72,743 width=40) (actual time=0.004..22.284 rows=72,649 loops=1,476)

  • Filter: (is_valid AND (expires > now()))
  • Rows Removed by Filter: 1,821
14. 0.006 0.019 ↑ 1.0 5 1

Hash (cost=3.36..3.36 rows=5 width=115) (actual time=0.019..0.019 rows=5 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
15. 0.013 0.013 ↑ 1.0 5 1

Index Scan using consent_requests_consent_request_id_idx on consent_requests (cost=0.13..3.36 rows=5 width=115) (actual time=0.010..0.013 rows=5 loops=1)

16. 7.758 7.758 ↑ 1.0 1 1,293

Index Scan using users_pkey on users (cost=0.42..0.50 rows=1 width=30) (actual time=0.006..0.006 rows=1 loops=1,293)

  • Index Cond: (user_id = purchases.user_id)
Planning time : 2.428 ms
Execution time : 58,194.277 ms