explain.depesz.com

PostgreSQL's explain analyze made readable

Result: aolG

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 59.186 ↓ 0.0 0 1

GroupAggregate (cost=72,920.74..72,921.34 rows=24 width=125) (actual time=59.186..59.186 rows=0 loops=1)

  • Group Key: email_conversations.id, users.firstname, users.lastname, read_status.unread_notifications
2. 0.010 59.185 ↓ 0.0 0 1

Sort (cost=72,920.74..72,920.80 rows=24 width=121) (actual time=59.185..59.185 rows=0 loops=1)

  • Sort Key: email_conversations.id, users.firstname, users.lastname, read_status.unread_notifications
  • Sort Method: quicksort Memory: 25kB
3. 0.000 59.175 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.70..72,920.19 rows=24 width=121) (actual time=59.175..59.175 rows=0 loops=1)

  • Join Filter: (read_status.notifiable_id = email_conversations.id)
4. 0.003 59.175 ↓ 0.0 0 1

Nested Loop (cost=1.27..67,403.39 rows=24 width=117) (actual time=59.175..59.175 rows=0 loops=1)

5. 0.013 0.013 ↑ 1.0 1 1

Index Scan using users_pkey on users (cost=0.42..8.45 rows=1 width=19) (actual time=0.011..0.013 rows=1 loops=1)

  • Index Cond: (id = 787653)
  • Filter: (account_id = 29)
6. 0.001 59.159 ↓ 0.0 0 1

Nested Loop (cost=0.85..67,394.70 rows=24 width=106) (actual time=59.159..59.159 rows=0 loops=1)

7. 59.158 59.158 ↓ 0.0 0 1

Index Scan using email_messages_direction_sender_user_id_index on email_messages (cost=0.42..66,862.04 rows=63 width=16) (actual time=59.158..59.158 rows=0 loops=1)

  • Index Cond: (sender_user_id = 787653)
  • Filter: (account_id = 29)
8. 0.000 0.000 ↓ 0.0 0

Index Scan using email_conversations_pkey on email_conversations (cost=0.42..8.45 rows=1 width=94) (never executed)

  • Index Cond: (id = email_messages.conversation_id)
  • Filter: ((deleted_at IS NULL) AND (account_id = 29))
9. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.43..5,516.45 rows=1 width=8) (never executed)

10. 0.000 0.000 ↓ 0.0 0

Subquery Scan on read_status (cost=0.43..5,516.44 rows=1 width=8) (never executed)

11. 0.000 0.000 ↓ 0.0 0

GroupAggregate (cost=0.43..5,516.43 rows=1 width=12) (never executed)

  • Group Key: notifications.notifiable_id, notifications.user_id
12. 0.000 0.000 ↓ 0.0 0

Index Scan using notifications_notifiable_type_notifiable_id_user_id_index on notifications (cost=0.43..5,516.41 rows=1 width=8) (never executed)

  • Index Cond: (((notifiable_type)::text = 'email_conversations'::text) AND (user_id = 711))
  • Filter: ((read_at IS NULL) AND ((type)::text = 'new_incoming_message'::text))
Planning time : 1.140 ms
Execution time : 59.327 ms