explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hw0X

Settings
# exclusive inclusive rows x rows loops node
1. 2.757 139.541 ↑ 1.0 2,000 1

Sort (cost=201,977.15..201,982.15 rows=2,000 width=1,066) (actual time=139.312..139.541 rows=2,000 loops=1)

  • Sort Key: "messagesMigration"."messageId
  • Sort Method: quicksort Memory: 2080kB
2. 1.256 136.784 ↑ 1.0 2,000 1

Nested Loop Left Join (cost=463.42..201,867.49 rows=2,000 width=1,066) (actual time=3.391..136.784 rows=2,000 loops=1)

3. 1.149 133.528 ↑ 1.0 2,000 1

Nested Loop Left Join (cost=463.13..200,452.09 rows=2,000 width=814) (actual time=3.388..133.528 rows=2,000 loops=1)

4. 1.386 130.379 ↑ 1.0 2,000 1

Nested Loop (cost=462.84..199,602.06 rows=2,000 width=775) (actual time=3.385..130.379 rows=2,000 loops=1)

5. 0.776 126.993 ↑ 1.0 2,000 1

Hash Join (cost=462.56..198,205.26 rows=2,000 width=523) (actual time=3.380..126.993 rows=2,000 loops=1)

  • Hash Cond: ("message->conversation".id = "message->conversation->users"."conversationId")
6. 0.140 123.001 ↑ 1.0 1,000 1

Limit (cost=1.14..197,708.84 rows=1,000 width=468) (actual time=0.117..123.001 rows=1,000 loops=1)

7. 0.543 122.861 ↑ 9.9 1,000 1

Nested Loop (cost=1.14..1,967,192.74 rows=9,950 width=468) (actual time=0.116..122.861 rows=1,000 loops=1)

8. 0.774 121.318 ↑ 9.9 1,000 1

Nested Loop (cost=0.86..1,963,848.04 rows=9,950 width=411) (actual time=0.113..121.318 rows=1,000 loops=1)

9. 0.704 119.544 ↑ 9.9 1,000 1

Nested Loop (cost=0.57..1,957,442.85 rows=9,950 width=159) (actual time=0.111..119.544 rows=1,000 loops=1)

10. 0.840 117.840 ↑ 9.9 1,000 1

Index Scan using "messagesMigration_pkey" on "messagesMigration" (cost=0.29..1,952,489.48 rows=9,950 width=43) (actual time=0.109..117.840 rows=1,000 loops=1)

  • Filter: ((NOT migrated) AND ((SubPlan 1) IS NOT NULL))
11.          

SubPlan (for Index Scan)

12. 1.000 117.000 ↑ 1.0 1 1,000

Limit (cost=8.88..195.17 rows=1 width=8) (actual time=0.117..0.117 rows=1 loops=1,000)

13. 0.000 116.000 ↑ 2.0 1 1,000

Nested Loop (cost=8.88..381.46 rows=2 width=8) (actual time=0.116..0.116 rows=1 loops=1,000)

14. 2.000 115.000 ↑ 2.0 1 1,000

Nested Loop (cost=8.60..380.79 rows=2 width=12) (actual time=0.115..0.115 rows=1 loops=1,000)

  • Join Filter: (message_1."conversationId" = conversation.id)
15. 48.000 112.000 ↑ 2.0 1 1,000

Hash Join (cost=8.31..380.15 rows=2 width=20) (actual time=0.112..0.112 rows=1 loops=1,000)

  • Hash Cond: ("conversation->users"."conversationId" = message_1."conversationId")
16. 62.000 62.000 ↑ 13.8 741 1,000

Seq Scan on "conversationUsers" "conversation->users" (cost=0.00..333.41 rows=10,241 width=8) (actual time=0.001..0.062 rows=741 loops=1,000)

17. 1.000 2.000 ↑ 1.0 1 1,000

Hash (cost=8.30..8.30 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=1,000)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
18. 1.000 1.000 ↑ 1.0 1 1,000

Index Scan using messages_pkey on messages message_1 (cost=0.29..8.30 rows=1 width=12) (actual time=0.001..0.001 rows=1 loops=1,000)

  • Index Cond: (id = "messagesMigration"."messageId")
19. 1.000 1.000 ↑ 1.0 1 1,000

Index Only Scan using conversations_pkey on conversations conversation (cost=0.28..0.31 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1,000)

  • Index Cond: (id = "conversation->users"."conversationId")
  • Heap Fetches: 0
20. 1.000 1.000 ↑ 1.0 1 1,000

Index Only Scan using users_pkey on users "conversation->users->user" (cost=0.29..0.33 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1,000)

  • Index Cond: (id = "conversation->users"."userId")
  • Heap Fetches: 0
21. 1.000 1.000 ↑ 1.0 1 1,000

Index Scan using messages_pkey on messages message (cost=0.29..0.49 rows=1 width=116) (actual time=0.001..0.001 rows=1 loops=1,000)

  • Index Cond: (id = "messagesMigration"."messageId")
22. 1.000 1.000 ↑ 1.0 1 1,000

Index Scan using users_pkey on users "message->user" (cost=0.29..0.63 rows=1 width=252) (actual time=0.001..0.001 rows=1 loops=1,000)

  • Index Cond: (id = message."userId")
23. 1.000 1.000 ↑ 1.0 1 1,000

Index Scan using conversations_pkey on conversations "message->conversation" (cost=0.28..0.33 rows=1 width=57) (actual time=0.001..0.001 rows=1 loops=1,000)

  • Index Cond: (id = message."conversationId")
24. 1.824 3.216 ↑ 1.0 10,241 1

Hash (cost=333.41..333.41 rows=10,241 width=55) (actual time=3.216..3.216 rows=10,241 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 1008kB
25. 1.392 1.392 ↑ 1.0 10,241 1

Seq Scan on "conversationUsers" "message->conversation->users" (cost=0.00..333.41 rows=10,241 width=55) (actual time=0.002..1.392 rows=10,241 loops=1)

26. 2.000 2.000 ↑ 1.0 1 2,000

Index Scan using users_pkey on users "message->conversation->users->user" (cost=0.29..0.69 rows=1 width=252) (actual time=0.001..0.001 rows=1 loops=2,000)

  • Index Cond: (id = "message->conversation->users"."userId")
27. 2.000 2.000 ↑ 1.0 1 2,000

Index Scan using "usersMigration_pkey" on "usersMigration" "message->conversation->users->user->userMigration" (cost=0.29..0.42 rows=1 width=39) (actual time=0.001..0.001 rows=1 loops=2,000)

  • Index Cond: ("message->conversation->users->user".id = "userId")
28. 2.000 2.000 ↑ 1.0 1 2,000

Index Scan using users_pkey on users "message->conversation->users->user->userMigration->user" (cost=0.29..0.70 rows=1 width=252) (actual time=0.001..0.001 rows=1 loops=2,000)

  • Index Cond: ("message->conversation->users->user->userMigration"."userId" = id)
Planning time : 1.275 ms
Execution time : 139.889 ms