explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yTgO

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=78,608.91..7,860,894.23 rows=100 width=48) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Function Scan on _subs (cost=0.01..1.00 rows=100 width=48) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Aggregate (cost=78,608.90..78,608.91 rows=1 width=32) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=78,601.89..78,603.06 rows=467 width=40) (actual rows= loops=)

  • Sort Key: chats.created_at,
5. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=244.64..78,581.19 rows=467 width=40) (actual rows= loops=)

  • -> Result (cost=0.00..0.01 rows=1 width=32
6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=83.70..3,406.39 rows=467 width=23) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Index Only Scan using users_pkey on users _0__be_0_app_users (cost=0.15..8.17 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = ((_subs.result_vars #>> '{query,userId}'::text[]))::integer)
8. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on chats (cost=83.55..3,393.55 rows=467 width=27) (actual rows= loops=)

  • Recheck Cond: (latest_agent_id = ((_subs.result_vars #>> '{query,userId}'::text[]))::integer)
  • Filter: (is_finalized_by_agent = ((_subs.result_vars #>> '{synthetic,0}'::text[]))::boolean)
9. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on chats_latest_agent_id_idx (cost=0.00..83.43 rows=934 width=0) (actual rows= loops=)

  • Index Cond: (latest_agent_id = ((_subs.result_vars #>> '{query,userId}'::text[]))::integer)
10. 0.000 0.000 ↓ 0.0

Aggregate (cost=160.93..160.94 rows=1 width=32) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Index Scan using messages_chat_id_platform_sequence_id_key on messages (cost=0.43..159.71 rows=81 width=8) (actual rows= loops=)

  • Index Cond: (chats.id = chat_id)
12.          

SubPlan (for Aggregate)

13. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.01 rows=1 width=32) (actual rows= loops=)