explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7ACO

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 699.751 ↓ 0.0 0 1

Limit (cost=10,712.02..10,712.04 rows=8 width=346) (actual time=699.751..699.751 rows=0 loops=1)

2. 0.056 699.749 ↓ 0.0 0 1

Sort (cost=10,712.02..10,712.04 rows=8 width=346) (actual time=699.749..699.749 rows=0 loops=1)

  • Sort Key: m4.inserted_at DESC NULLS LAST, u1.last_name
  • Sort Method: quicksort Memory: 25kB
3. 0.000 699.693 ↓ 0.0 0 1

Nested Loop Left Join (cost=7.45..10,711.90 rows=8 width=346) (actual time=699.693..699.693 rows=0 loops=1)

4. 0.001 699.693 ↓ 0.0 0 1

Nested Loop Left Join (cost=7.03..10,688.49 rows=8 width=338) (actual time=699.693..699.693 rows=0 loops=1)

5. 0.000 699.692 ↓ 0.0 0 1

Nested Loop Left Join (cost=6.75..10,685.56 rows=8 width=338) (actual time=699.692..699.692 rows=0 loops=1)

  • Join Filter: (s5.sender_id = s0.member_id)
6. 0.001 699.692 ↓ 0.0 0 1

Nested Loop Left Join (cost=3.80..10,682.47 rows=8 width=346) (actual time=699.692..699.692 rows=0 loops=1)

  • Join Filter: (m4.id = s3.id)
7. 0.000 699.691 ↓ 0.0 0 1

Nested Loop Left Join (cost=3.80..10,673.31 rows=8 width=151) (actual time=699.691..699.691 rows=0 loops=1)

8. 0.001 699.691 ↓ 0.0 0 1

Nested Loop (cost=0.71..10,648.35 rows=8 width=151) (actual time=699.691..699.691 rows=0 loops=1)

9. 0.001 699.690 ↓ 0.0 0 1

Nested Loop (cost=0.42..10,644.41 rows=8 width=146) (actual time=699.690..699.690 rows=0 loops=1)

10. 699.689 699.689 ↓ 0.0 0 1

Seq Scan on users u1 (cost=0.00..10,144.96 rows=60 width=43) (actual time=699.689..699.689 rows=0 loops=1)

  • Filter: (unaccent(concat_ws(' '::text, email, first_name, last_name)) ~~* unaccent('Mihai'::text))
  • Rows Removed by Filter: 191,320
11. 0.000 0.000 ↓ 0.0 0

Index Scan using subscriptions_member_id_index on subscriptions s0 (cost=0.42..8.31 rows=1 width=103) (never executed)

  • Index Cond: (member_id = u1.id)
  • Filter: ((member_id <> 'ef9f58fa-574e-4473-ad18-5a2e6ff9d824'::uuid) AND (publication_id = 'f9c85b73-1357-4936-a226-f135f56a73d4'::uuid) AND (state = ANY ('{active,in_trial,active,not_renewing}'::text[])))
12. 0.000 0.000 ↓ 0.0 0

Index Scan using plans_pkey on plans p2 (cost=0.29..0.48 rows=1 width=37) (never executed)

  • Index Cond: (id = s0.plan_id)
13. 0.000 0.000 ↓ 0.0 0

Subquery Scan on s3 (cost=3.09..3.11 rows=1 width=48) (never executed)

  • Filter: ((s3.sender_id = s0.member_id) OR (s3.recipient_id = s0.member_id))
14. 0.000 0.000 ↓ 0.0 0

Limit (cost=3.09..3.09 rows=1 width=56) (never executed)

15. 0.000 0.000 ↓ 0.0 0

Sort (cost=3.09..3.09 rows=1 width=56) (never executed)

  • Sort Key: sm0.inserted_at DESC
16. 0.000 0.000 ↓ 0.0 0

Seq Scan on messages sm0 (cost=0.00..3.08 rows=1 width=56) (never executed)

  • Filter: ((recipient_id <> sender_id) AND (s0.publication_id = publication_id) AND ((recipient_id = s0.member_id) OR (sender_id = s0.member_id)))
17. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..2.81 rows=54 width=211) (never executed)

18. 0.000 0.000 ↓ 0.0 0

Seq Scan on messages m4 (cost=0.00..2.54 rows=54 width=211) (never executed)

19. 0.000 0.000 ↓ 0.0 0

Materialize (cost=2.95..2.97 rows=1 width=24) (never executed)

20. 0.000 0.000 ↓ 0.0 0

Subquery Scan on s5 (cost=2.95..2.97 rows=1 width=24) (never executed)

21. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=2.95..2.96 rows=1 width=32) (never executed)

  • Group Key: sm0_1.sender_id
22. 0.000 0.000 ↓ 0.0 0

Seq Scan on messages sm0_1 (cost=0.00..2.95 rows=1 width=32) (never executed)

  • Filter: ((read_at IS NULL) AND (sender_id <> recipient_id) AND (recipient_id = 'ef9f58fa-574e-4473-ad18-5a2e6ff9d824'::uuid) AND (publication_id = 'f9c85b73-1357-4936-a226-f135f56a73d4'::uuid))
23. 0.000 0.000 ↓ 0.0 0

Index Scan using subscription_guests_pkey on subscription_guests s6 (cost=0.29..0.36 rows=1 width=32) (never executed)

  • Index Cond: (id = s0.subscription_guest_id)
24. 0.000 0.000 ↓ 0.0 0

Index Scan using subscriptions_pkey on subscriptions s7 (cost=0.42..2.92 rows=1 width=40) (never executed)

  • Index Cond: (s6.subscription_id = id)
Planning time : 9.249 ms
Execution time : 700.177 ms