explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DqRh

Settings
# exclusive inclusive rows x rows loops node
1. 8.847 53,519.141 ↑ 5.8 300 1

Nested Loop (cost=208,651.44..223,913.00 rows=1,755 width=223) (actual time=53,419.785..53,519.141 rows=300 loops=1)

2.          

CTE conversations_last_take_action

3. 22.582 53,461.647 ↑ 19.5 540 1

Unique (cost=121,942.81..121,995.48 rows=10,534 width=25) (actual time=53,419.647..53,461.647 rows=540 loops=1)

4. 40.801 53,439.065 ↑ 4.0 2,616 1

Sort (cost=121,942.81..121,969.14 rows=10,534 width=25) (actual time=53,419.632..53,439.065 rows=2,616 loops=1)

  • Sort Key: "conversationTakeEvent".conversation_id
  • Sort Method: quicksort Memory: 301kB
5. 26,721.394 53,398.264 ↑ 4.0 2,616 1

Hash Join (cost=5,903.37..121,238.99 rows=10,534 width=25) (actual time=52,893.606..53,398.264 rows=2,616 loops=1)

  • Hash Cond: ("conversationTakeEvent".conversation_id = conversation_1.conversation_id)
6. 26,348.612 26,348.612 ↑ 1.4 3,535,651 1

Seq Scan on "conversationTakeEvent" (cost=0.00..96,079.78 rows=5,099,778 width=30) (actual time=0.021..26,348.612 rows=3,535,651 loops=1)

7. 148.011 328.258 ↑ 1.1 16,649 1

Hash (cost=5,676.19..5,676.19 rows=18,174 width=16) (actual time=328.250..328.258 rows=16,649 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1037kB
8. 180.247 180.247 ↑ 1.1 16,649 1

Index Scan using "conversation_closedAt_idx" on conversation conversation_1 (cost=0.43..5,676.19 rows=18,174 width=16) (actual time=0.036..180.247 rows=16,649 loops=1)

  • Index Cond: ("closedAt" IS NULL)
  • Filter: (project_id <> 'eewnswogqhbiufgvyijpmts-72'::text)
9.          

CTE old_state

10. 16.552 53,497.932 ↑ 19.5 540 1

Nested Loop (cost=0.56..86,655.40 rows=10,534 width=35) (actual time=53,419.715..53,497.932 rows=540 loops=1)

11. 53,469.500 53,469.500 ↑ 19.5 540 1

CTE Scan on conversations_last_take_action (cost=0.00..210.68 rows=10,534 width=25) (actual time=53,419.664..53,469.500 rows=540 loops=1)

12. 11.880 11.880 ↑ 1.0 1 540

Index Scan using conversation_conversation_id_pkey on conversation conversation_2 (cost=0.56..8.20 rows=1 width=26) (actual time=0.015..0.022 rows=1 loops=540)

  • Index Cond: (conversation_id = conversations_last_take_action.conversation_id)
13. 53,504.518 53,504.518 ↑ 5.8 304 1

CTE Scan on old_state (cost=0.00..289.69 rows=1,756 width=57) (actual time=53,419.746..53,504.518 rows=304 loops=1)

  • Filter: ("isTaken" AND ("createdAt" < (now() - '00:05:00'::interval)))
  • Rows Removed by Filter: 236
14. 5.776 5.776 ↑ 1.0 1 304

Index Scan using conversation_conversation_id_pkey on conversation (cost=0.56..8.52 rows=1 width=166) (actual time=0.011..0.019 rows=1 loops=304)

  • Index Cond: (conversation_id = old_state.conversation_id)
  • Filter: ((type <> 'MobileAppConversation'::text) AND (project_id <> 'eewnswogqhbiufgvyijpmts-72'::text))
  • Rows Removed by Filter: 0