explain.depesz.com

PostgreSQL's explain analyze made readable

Result: INZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.074 42.261 ↑ 1.0 1,000 1

Limit (cost=2.01..14,301.16 rows=1,000 width=953) (actual time=0.423..42.261 rows=1,000 loops=1)

2. 0.525 42.187 ↑ 14,605.3 1,000 1

Nested Loop (cost=2.01..208,843,878.24 rows=14,605,340 width=953) (actual time=0.422..42.187 rows=1,000 loops=1)

3. 0.314 36.662 ↑ 14,605.3 1,000 1

Nested Loop (cost=1.44..178,635,325.74 rows=14,605,340 width=490) (actual time=0.409..36.662 rows=1,000 loops=1)

4. 0.073 25.348 ↑ 14,605.3 1,000 1

Nested Loop (cost=1.01..150,571,634.84 rows=14,605,340 width=136) (actual time=0.124..25.348 rows=1,000 loops=1)

5. 1.603 22.275 ↑ 14,605.3 1,000 1

Index Scan using "messagesMigration_pkey" on "messagesMigration" (cost=0.43..116,861,644.24 rows=14,605,340 width=57) (actual time=0.114..22.275 rows=1,000 loops=1)

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

SubPlan (for Index Scan)

7. 1.088 20.672 ↑ 1.0 1 1,088

Limit (cost=2.15..7.51 rows=1 width=8) (actual time=0.018..0.019 rows=1 loops=1,088)

8. 0.264 19.584 ↑ 2.0 1 1,088

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

9. 1.440 16.320 ↑ 2.0 1 1,088

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

  • Join Filter: (message_1."conversationId" = "conversation->users"."conversationId")
10. 0.000 10.880 ↑ 1.0 1 1,088

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

11. 6.528 6.528 ↑ 1.0 1 1,088

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

  • Index Cond: (id = "messagesMigration"."messageId")
12. 4.352 4.352 ↑ 1.0 1 1,088

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

  • Index Cond: (id = message_1."conversationId")
  • Heap Fetches: 1472
13. 4.000 4.000 ↑ 24.0 1 1,000

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

  • Index Cond: ("conversationId" = conversation.id)
14. 3.000 3.000 ↑ 1.0 1 1,000

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

  • Index Cond: (id = "conversation->users"."userId")
  • Heap Fetches: 767
15. 3.000 3.000 ↑ 1.0 1 1,000

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

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

Index Scan using users_id_key on users "message->user" (cost=0.43..1.91 rows=1 width=354) (actual time=0.008..0.011 rows=1 loops=1,000)

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

Index Scan using conversations_pkey on conversations "message->conversation" (cost=0.57..2.06 rows=1 width=463) (actual time=0.002..0.005 rows=1 loops=1,000)

  • Index Cond: (id = message."conversationId")
Planning time : 4.296 ms
Execution time : 42.600 ms