explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yDNr : Optimization for: plan #yTgO

Settings

Optimization path:

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

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

2. 0.000 0.000 ↓ 0.0

Aggregate (cost=177.64..177.65 rows=1 width=32) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Sort (cost=177.62..177.63 rows=1 width=40) (actual rows= loops=)

  • Sort Key: chats.created_at
4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=161.52..177.61 rows=1 width=40) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Nested Loop Semi Join (cost=0.59..16.64 rows=1 width=41) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Index Scan using \ getAgentChats_idx\" on chats (cost=0.43..8.46 rows=1 width=45) (actual rows= loops=)

  • Index Cond: ((ended_at IS NULL) AND (latest_agent_id = ((_subs.result_vars #>> '{query,userId}'::text[]))::integer) AND (is_finalized_by_agent = ((_subs.result_vars #>> '{synthetic,0}'::text[]))::boolean))
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

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

9. 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)
10.          

SubPlan (for Aggregate)

11. 0.000 0.000 ↓ 0.0

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

12.          

SubPlan (for Nested Loop Left Join)

13. 0.000 0.000 ↓ 0.0

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