explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 263r

Settings
# exclusive inclusive rows x rows loops node
1. 6.554 5,558.577 ↑ 1.0 20 1

Limit (cost=65,325.83..65,327.23 rows=20 width=875) (actual time=5,551.875..5,558.577 rows=20 loops=1)

2. 0.179 5,552.023 ↑ 18.5 20 1

Result (cost=65,325.83..65,351.73 rows=370 width=875) (actual time=5,551.871..5,552.023 rows=20 loops=1)

3. 65.392 5,551.844 ↑ 18.5 20 1

Sort (cost=65,325.83..65,326.76 rows=370 width=890) (actual time=5,551.840..5,551.844 rows=20 loops=1)

  • Sort Key: sender.created_at DESC
  • Sort Method: top-N heapsort Memory: 119kB
4. 1,736.637 5,486.452 ↓ 133.4 49,341 1

GroupAggregate (cost=65,274.36..65,315.98 rows=370 width=890) (actual time=3,565.081..5,486.452 rows=49,341 loops=1)

  • Group Key: sender.id, for_resolution.id, sender_user.first_name, sender_user.middle_name, sender_user.last_name, doc.brief_content, sibling_of_sender.id, userssibling_of_sender.first_name, userssibling_of_sender.middle_name, userssibling_of_sender.last_name, root_task.document_id, root_task.document_recipient_reg_number, root_task.document_recipient_reg_date, root_task.document_sender_reg_number, root_task.document_sender_reg_date
5. 1,247.421 3,749.815 ↓ 380.4 140,730 1

Sort (cost=65,274.36..65,275.28 rows=370 width=930) (actual time=3,564.957..3,749.815 rows=140,730 loops=1)

  • Sort Key: sender.id, for_resolution.id, sender_user.first_name, sender_user.middle_name, sender_user.last_name, doc.brief_content, sibling_of_sender.id, userssibling_of_sender.first_name, userssibling_of_sender.middle_name, userssibling_of_sender.last_name, root_task.document_id, root_task.document_recipient_reg_number, root_task.document_recipient_reg_date, root_task.document_sender_reg_number, root_task.document_sender_reg_date
  • Sort Method: external merge Disk: 108728kB
6. 0.000 2,502.394 ↓ 380.4 140,730 1

Gather (cost=24,966.44..65,258.58 rows=370 width=930) (actual time=388.197..2,502.394 rows=140,730 loops=1)

  • Workers Planned: 3
  • Workers Launched: 3
7. 312.060 2,550.088 ↓ 295.6 35,182 4

Nested Loop Left Join (cost=23,966.44..64,221.58 rows=119 width=930) (actual time=364.773..2,550.088 rows=35,182 loops=4)

8. 389.914 2,238.021 ↓ 295.6 35,182 4

Nested Loop (cost=23,966.03..64,053.02 rows=119 width=902) (actual time=364.720..2,238.021 rows=35,182 loops=4)

9. 302.463 1,848.084 ↓ 27.9 14,838 4

Nested Loop Left Join (cost=23,965.47..60,109.59 rows=531 width=830) (actual time=364.663..1,848.084 rows=14,838 loops=4)

10. 199.800 1,545.603 ↓ 154.6 14,838 4

Nested Loop (cost=23,964.92..59,789.35 rows=96 width=806) (actual time=364.520..1,545.603 rows=14,838 loops=4)

11. 106.061 1,345.789 ↓ 129.6 12,442 4

Nested Loop Left Join (cost=23,964.36..59,028.17 rows=96 width=770) (actual time=364.460..1,345.789 rows=12,442 loops=4)

12. 183.050 1,239.722 ↓ 129.6 12,442 4

Nested Loop Left Join (cost=23,963.95..58,892.19 rows=96 width=742) (actual time=364.421..1,239.722 rows=12,442 loops=4)

13. 115.658 1,056.660 ↓ 129.6 12,442 4

Nested Loop Left Join (cost=23,963.52..58,753.66 rows=96 width=574) (actual time=364.343..1,056.660 rows=12,442 loops=4)

14. 242.838 940.995 ↓ 129.6 12,442 4

Nested Loop (cost=23,963.11..58,617.64 rows=96 width=546) (actual time=364.264..940.995 rows=12,442 loops=4)

15. 248.578 698.140 ↓ 34.9 12,449 4

Nested Loop (cost=23,962.55..55,922.68 rows=357 width=474) (actual time=364.181..698.140 rows=12,449 loops=4)

16. 79.532 449.544 ↓ 2.2 12,608 4

Parallel Bitmap Heap Scan on tasks sender (cost=23,962.00..41,839.82 rows=5,841 width=109) (actual time=364.065..449.544 rows=12,608 loops=4)

  • Recheck Cond: (((sender_user_id)::text = ANY ('{5b375c3dab11dd5071c5d559,5b84f24c40332645ceee8cde,5b84f65e40332645ceee8d53,593a79f903212a74286cfb6f,5af3e184f2268c668f9e0099,593a7d4903212a74286cfc30,5b37598cab11dd5071c5d529,5b375821ab11dd5071c5d51a,5be0360c799e564b02efeedc,5d1c9bc36d5e0f19076caffd,59eeeb353fc30f5cb7a46f4b,5b84e8e040332645ceee8bd7,5b84ee7a40332645ceee8c4a,5ba4d3ac1de0eb92ad025150,5ba8ba441de0eb92ad025192,5b84f80440332645ceee8d7d}'::text[])) AND ((type)::text = 'SENDER'::text))
  • Filter: ((NOT is_deleted) AND (NOT draft))
  • Heap Blocks: exact=11962
17. 14.133 370.012 ↓ 0.0 0 1

BitmapAnd (cost=23,962.00..23,962.00 rows=18,106 width=0) (actual time=370.012..370.012 rows=0 loops=1)

18. 35.870 35.870 ↓ 1.4 168,609 1

Bitmap Index Scan on tasks_sender_user_id_index (cost=0.00..1,755.56 rows=122,750 width=0) (actual time=35.870..35.870 rows=168,609 loops=1)

  • Index Cond: ((sender_user_id)::text = ANY ('{5b375c3dab11dd5071c5d559,5b84f24c40332645ceee8cde,5b84f65e40332645ceee8d53,593a79f903212a74286cfb6f,5af3e184f2268c668f9e0099,593a7d4903212a74286cfc30,5b37598cab11dd5071c5d529,5b375821ab11dd5071c5d51a,5be0360c799e564b02efeedc,5d1c9bc36d5e0f19076caffd,59eeeb353fc30f5cb7a46f4b,5b84e8e040332645ceee8bd7,5b84ee7a40332645ceee8c4a,5ba4d3ac1de0eb92ad025150,5ba8ba441de0eb92ad025192,5b84f80440332645ceee8d7d}'::text[]))
19. 320.009 320.009 ↓ 1.0 1,140,413 1

Bitmap Index Scan on tasks_type_draft_is_active_is_deleted_due_date_index (cost=0.00..22,197.13 rows=1,112,431 width=0) (actual time=320.008..320.009 rows=1,140,413 loops=1)

  • Index Cond: (((type)::text = 'SENDER'::text) AND (draft = false) AND (is_deleted = false))
20. 0.018 0.018 ↑ 1.0 1 50,431

Index Scan using tasks_pkey on tasks for_resolution (cost=0.56..2.41 rows=1 width=365) (actual time=0.018..0.018 rows=1 loops=50,431)

  • Index Cond: ((id)::text = (sender.parent_id)::text)
  • Filter: ((is_deleted IS NOT TRUE) AND (document_id IS NOT NULL) AND ((type)::text = 'FOR_RESOLUTION'::text))
  • Rows Removed by Filter: 0
21. 0.017 0.017 ↑ 4.0 1 49,795

Index Scan using tasks_parent_id_type_is_deleted_index on tasks sibling_of_sender (cost=0.56..7.51 rows=4 width=97) (actual time=0.016..0.017 rows=1 loops=49,795)

  • Index Cond: (((parent_id)::text = (for_resolution.id)::text) AND (is_deleted = false))
  • Filter: ((recipient_user_id IS NOT NULL) AND (NOT is_deleted) AND ((type)::text <> 'SENDER'::text))
  • Rows Removed by Filter: 1
22. 0.007 0.007 ↑ 1.0 1 49,770

Index Scan using users_pkey on users sender_user (cost=0.41..1.42 rows=1 width=78) (actual time=0.007..0.007 rows=1 loops=49,770)

  • Index Cond: ((id)::text = (for_resolution.sender_user_id)::text)
23. 0.012 0.012 ↑ 1.0 1 49,770

Index Scan using documents_pkey on documents doc (cost=0.42..1.44 rows=1 width=193) (actual time=0.012..0.012 rows=1 loops=49,770)

  • Index Cond: ((id)::text = (for_resolution.document_id)::text)
24. 0.006 0.006 ↑ 1.0 1 49,770

Index Scan using users_pkey on users userssibling_of_sender (cost=0.41..1.42 rows=1 width=78) (actual time=0.006..0.006 rows=1 loops=49,770)

  • Index Cond: ((id)::text = (sibling_of_sender.recipient_user_id)::text)
25. 0.014 0.014 ↑ 14.0 1 49,770

Index Scan using tasks_parent_id_type_is_deleted_index on tasks "actionOfsibling_of_sender" (cost=0.56..7.79 rows=14 width=61) (actual time=0.013..0.014 rows=1 loops=49,770)

  • Index Cond: ((parent_id)::text = (sibling_of_sender.id)::text)
26. 0.018 0.018 ↑ 1.0 1 59,351

Index Scan using tasks_document_id_db_id_type_is_deleted_index on tasks root_task (cost=0.56..3.33 rows=1 width=49) (actual time=0.018..0.018 rows=1 loops=59,351)

  • Index Cond: (((document_id)::text = (sender.document_id)::text) AND ((db_id)::text = '58db4eaa22e00b0ef61d4496'::text) AND ((type)::text = 'ROOT_TASK'::text))
  • Filter: (is_deleted IS NOT TRUE)
27. 0.023 0.023 ↑ 1.5 2 59,351

Index Scan using tasks_parent_id_type_is_deleted_index on tasks "recipientOfsibling_of_sender" (cost=0.56..7.40 rows=3 width=97) (actual time=0.016..0.023 rows=2 loops=59,351)

  • Index Cond: (((parent_id)::text = ("actionOfsibling_of_sender".id)::text) AND (is_deleted = false))
  • Filter: ((recipient_user_id IS NOT NULL) AND (NOT is_deleted) AND ((type)::text <> 'SENDER'::text) AND ((type)::text <> 'SENDER'::text))
  • Rows Removed by Filter: 2
28. 0.007 0.007 ↑ 1.0 1 140,730

Index Scan using users_pkey on users "usersActionOfsibling_of_sender" (cost=0.41..1.42 rows=1 width=78) (actual time=0.007..0.007 rows=1 loops=140,730)

  • Index Cond: ((id)::text = ("recipientOfsibling_of_sender".recipient_user_id)::text)
29.          

SubPlan (forGroupAggregate)

30. 0.000 0.000 ↑ 1.0 1 49,341

Result (cost=0.00..0.01 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=49,341)

Planning time : 13.181 ms
Execution time : 5,582.904 ms