explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Kj3e

Settings
# exclusive inclusive rows x rows loops node
1. 6.537 214.379 ↑ 9.1 2,000 1

Sort (cost=53,928.87..53,974.47 rows=18,237 width=1,759) (actual time=213.603..214.379 rows=2,000 loops=1)

  • Sort Key: "messagesMigration"."messageId
  • Sort Method: quicksort Memory: 4085kB
2. 5.729 207.842 ↑ 9.1 2,000 1

Hash Right Join (cost=24,265.22..52,638.19 rows=18,237 width=1,759) (actual time=110.440..207.842 rows=2,000 loops=1)

  • Hash Cond: ("message->conversation->users->user->userMigration"."userId" = "message->conversation->users->user".id)
3. 11.364 91.766 ↓ 1.0 11,182 1

Nested Loop Left Join (cost=0.43..28,331.55 rows=11,045 width=407) (actual time=0.024..91.766 rows=11,182 loops=1)

4. 2.128 2.128 ↓ 1.0 11,182 1

Seq Scan on "usersMigration" "message->conversation->users->user->userMigration" (cost=0.00..190.45 rows=11,045 width=53) (actual time=0.016..2.128 rows=11,182 loops=1)

5. 78.274 78.274 ↑ 1.0 1 11,182

Index Scan using "Users_pkey" on users "message->conversation->users->user->userMigration->user" (cost=0.43..2.54 rows=1 width=354) (actual time=0.007..0.007 rows=1 loops=11,182)

  • Index Cond: ("message->conversation->users->user->userMigration"."userId" = id)
6. 4.102 110.347 ↑ 9.1 2,000 1

Hash (cost=24,036.83..24,036.83 rows=18,237 width=1,352) (actual time=110.347..110.347 rows=2,000 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 2846kB
7. 0.465 106.245 ↑ 9.1 2,000 1

Nested Loop (cost=10,946.87..24,036.83 rows=18,237 width=1,352) (actual time=80.845..106.245 rows=2,000 loops=1)

8. 1.388 91.780 ↑ 9.1 2,000 1

Nested Loop (cost=10,946.44..15,545.47 rows=18,237 width=998) (actual time=80.835..91.780 rows=2,000 loops=1)

9. 0.130 81.392 ↓ 1.3 1,000 1

Limit (cost=10,945.87..10,947.77 rows=759 width=953) (actual time=80.822..81.392 rows=1,000 loops=1)

10. 3.884 81.262 ↓ 1.3 1,000 1

Sort (cost=10,945.87..10,947.77 rows=759 width=953) (actual time=80.822..81.262 rows=1,000 loops=1)

  • Sort Key: "messagesMigration"."messageId
  • Sort Method: quicksort Memory: 2260kB
11. 0.510 77.378 ↓ 2.1 1,596 1

Nested Loop (cost=1.58..10,909.56 rows=759 width=953) (actual time=0.093..77.378 rows=1,596 loops=1)

12. 0.846 70.484 ↓ 2.1 1,596 1

Nested Loop (cost=1.01..9,344.96 rows=759 width=490) (actual time=0.088..70.484 rows=1,596 loops=1)

13. 0.895 58.466 ↓ 2.1 1,596 1

Nested Loop (cost=0.58..7,891.95 rows=759 width=136) (actual time=0.081..58.466 rows=1,596 loops=1)

14. 1.679 52.783 ↓ 2.1 1,596 1

Seq Scan on "messagesMigration" (cost=0.00..5,762.95 rows=759 width=57) (actual time=0.076..52.783 rows=1,596 loops=1)

  • Filter: ((NOT migrated) AND ((SubPlan 1) IS NOT NULL))
  • Rows Removed by Filter: 1
15.          

SubPlan (for Seq Scan)

16. 1.597 51.104 ↑ 1.0 1 1,597

Limit (cost=2.15..7.51 rows=1 width=8) (actual time=0.032..0.032 rows=1 loops=1,597)

17. 0.008 49.507 ↑ 2.0 1 1,597

Nested Loop (cost=2.15..12.87 rows=2 width=8) (actual time=0.031..0.031 rows=1 loops=1,597)

18. 1.606 36.731 ↑ 2.0 1 1,597

Nested Loop (cost=1.72..10.30 rows=2 width=12) (actual time=0.023..0.023 rows=1 loops=1,597)

  • Join Filter: (message_1."conversationId" = "conversation->users"."conversationId")
19. 1.597 20.761 ↑ 1.0 1 1,597

Nested Loop (cost=1.15..5.59 rows=1 width=16) (actual time=0.013..0.013 rows=1 loops=1,597)

20. 6.388 6.388 ↑ 1.0 1 1,597

Index Scan using messages_pkey on messages message_1 (cost=0.58..2.79 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=1,597)

  • Index Cond: (id = "messagesMigration"."messageId")
21. 12.776 12.776 ↑ 1.0 1 1,597

Index Only Scan using conversations_pkey on conversations conversation (cost=0.57..2.79 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=1,597)

  • Index Cond: (id = message_1."conversationId")
  • Heap Fetches: 1596
22. 14.364 14.364 ↑ 24.0 1 1,596

Index Scan using conversation_users_conversation_id on "conversationUsers" "conversation->users" (cost=0.57..4.41 rows=24 width=8) (actual time=0.009..0.009 rows=1 loops=1,596)

  • Index Cond: ("conversationId" = conversation.id)
23. 12.768 12.768 ↑ 1.0 1 1,596

Index Only Scan using "Users_pkey" on users "conversation->users->user" (cost=0.43..1.28 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=1,596)

  • Index Cond: (id = "conversation->users"."userId")
  • Heap Fetches: 1591
24. 4.788 4.788 ↑ 1.0 1 1,596

Index Scan using messages_pkey on messages message (cost=0.58..2.79 rows=1 width=79) (actual time=0.003..0.003 rows=1 loops=1,596)

  • Index Cond: (id = "messagesMigration"."messageId")
25. 11.172 11.172 ↑ 1.0 1 1,596

Index Scan using "Users_pkey" on users "message->user" (cost=0.43..1.90 rows=1 width=354) (actual time=0.006..0.007 rows=1 loops=1,596)

  • Index Cond: (id = message."userId")
26. 6.384 6.384 ↑ 1.0 1 1,596

Index Scan using conversations_pkey on conversations "message->conversation" (cost=0.57..2.05 rows=1 width=463) (actual time=0.003..0.004 rows=1 loops=1,596)

  • Index Cond: (id = message."conversationId")
27. 9.000 9.000 ↑ 12.0 2 1,000

Index Scan using conversation_users_conversation_id on "conversationUsers" "message->conversation->users" (cost=0.57..5.81 rows=24 width=45) (actual time=0.007..0.009 rows=2 loops=1,000)

  • Index Cond: ("conversationId" = "message->conversation".id)
28. 14.000 14.000 ↑ 1.0 1 2,000

Index Scan using "Users_pkey" on users "message->conversation->users->user" (cost=0.43..0.46 rows=1 width=354) (actual time=0.006..0.007 rows=1 loops=2,000)

  • Index Cond: (id = "message->conversation->users"."userId")
Planning time : 3.566 ms
Execution time : 214.694 ms