explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UUf

Settings
# exclusive inclusive rows x rows loops node
1. 0.068 1,071.154 ↓ 48.7 682 1

Subquery Scan on q1 (cost=158,100.58..158,100.75 rows=14 width=65) (actual time=1,071.050..1,071.154 rows=682 loops=1)

2. 1.897 1,071.086 ↓ 48.7 682 1

Sort (cost=158,100.58..158,100.61 rows=14 width=1,185) (actual time=1,071.049..1,071.086 rows=682 loops=1)

  • Sort Key: (max((document.code)::text)), (max(version.sequential))
  • Sort Method: quicksort Memory: 142kB
3. 0.390 1,069.189 ↓ 48.7 682 1

GroupAggregate (cost=158,099.96..158,100.31 rows=14 width=1,185) (actual time=1,068.752..1,069.189 rows=682 loops=1)

  • Group Key: pendency.id, document.id, version.sequential
4. 0.582 1,068.799 ↓ 82.6 1,156 1

Sort (cost=158,099.96..158,100.00 rows=14 width=104) (actual time=1,068.744..1,068.799 rows=1,156 loops=1)

  • Sort Key: pendency.id, document.id, version.sequential
  • Sort Method: quicksort Memory: 211kB
5. 0.028 1,068.217 ↓ 82.6 1,156 1

Nested Loop (cost=136,084.31..158,099.69 rows=14 width=104) (actual time=584.802..1,068.217 rows=1,156 loops=1)

6. 0.000 1,067.033 ↓ 82.6 1,156 1

Nested Loop (cost=136,084.04..158,095.04 rows=14 width=112) (actual time=584.788..1,067.033 rows=1,156 loops=1)

7. 29.482 792.305 ↓ 12.1 138,363 1

Hash Join (cost=136,083.61..150,827.13 rows=11,416 width=104) (actual time=561.556..792.305 rows=138,363 loops=1)

  • Hash Cond: (pendency.action_id = action.id)
8. 165.526 762.692 ↓ 3.7 248,056 1

Hash Join (cost=136,021.65..150,505.15 rows=67,139 width=104) (actual time=561.401..762.692 rows=248,056 loops=1)

  • Hash Cond: (pendency.workflow_id = version.workflow_id)
9. 35.964 35.964 ↑ 1.0 532,947 1

Seq Scan on pendency (cost=0.00..11,815.47 rows=532,947 width=65) (actual time=0.005..35.964 rows=532,947 loops=1)

10. 13.180 561.202 ↓ 2.4 70,946 1

Hash (cost=135,648.31..135,648.31 rows=29,867 width=55) (actual time=561.202..561.202 rows=70,946 loops=1)

  • Buckets: 65,536 (originally 32768) Batches: 2 (originally 1) Memory Usage: 3,799kB
11. 76.327 548.022 ↓ 2.4 70,946 1

Hash Join (cost=119,781.94..135,648.31 rows=29,867 width=55) (actual time=442.805..548.022 rows=70,946 loops=1)

  • Hash Cond: (document.id = version.document_id)
12. 29.284 29.284 ↑ 1.0 122,775 1

Seq Scan on document (cost=0.00..14,340.75 rows=122,775 width=35) (actual time=0.006..29.284 rows=122,775 loops=1)

13. 10.847 442.411 ↓ 2.4 70,946 1

Hash (cost=119,408.60..119,408.60 rows=29,867 width=28) (actual time=442.411..442.411 rows=70,946 loops=1)

  • Buckets: 65,536 (originally 32768) Batches: 2 (originally 1) Memory Usage: 3,585kB
14. 33.343 431.564 ↓ 2.4 70,946 1

Hash Right Join (cost=114,099.61..119,408.60 rows=29,867 width=28) (actual time=383.340..431.564 rows=70,946 loops=1)

  • Hash Cond: (vat.version_id = version.id)
15. 14.999 14.999 ↑ 1.0 261,551 1

Seq Scan on version_attachment vat (cost=0.00..4,029.51 rows=261,551 width=16) (actual time=0.008..14.999 rows=261,551 loops=1)

16. 10.910 383.222 ↓ 1.7 46,995 1

Hash (cost=113,760.23..113,760.23 rows=27,150 width=36) (actual time=383.222..383.222 rows=46,995 loops=1)

  • Buckets: 65,536 (originally 32768) Batches: 1 (originally 1) Memory Usage: 3,817kB
17. 4.684 372.312 ↓ 1.7 46,995 1

Nested Loop Semi Join (cost=5,677.44..113,760.23 rows=27,150 width=36) (actual time=47.150..372.312 rows=46,995 loops=1)

  • Join Filter: ((vcl.office_id IS NULL) OR (vcl.office_id = up.office_id))
  • Rows Removed by Join Filter: 42,954
18. 3.819 132.653 ↓ 1.0 46,995 1

Nested Loop (cost=5,677.01..17,730.19 rows=46,387 width=44) (actual time=47.110..132.653 rows=46,995 loops=1)

19. 0.010 0.028 ↑ 1.0 1 1

Bitmap Heap Scan on user_project up (cost=4.30..10.85 rows=1 width=16) (actual time=0.023..0.028 rows=1 loops=1)

  • Recheck Cond: (user_id = 6,301)
  • Filter: ((config_item_group_id = 104) AND (status = 1))
  • Rows Removed by Filter: 1
  • Heap Blocks: exact=2
20. 0.018 0.018 ↑ 1.0 2 1

Bitmap Index Scan on user_project_user_id_idx (cost=0.00..4.29 rows=2 width=0) (actual time=0.018..0.018 rows=2 loops=1)

  • Index Cond: (user_id = 6,301)
21. 55.446 128.806 ↓ 1.0 46,995 1

Hash Join (cost=5,672.71..17,255.46 rows=46,387 width=44) (actual time=47.084..128.806 rows=46,995 loops=1)

  • Hash Cond: (version.workflow_id = workflow.id)
22. 26.482 26.482 ↑ 1.0 237,760 1

Seq Scan on version (cost=0.00..10,228.60 rows=237,760 width=28) (actual time=0.006..26.482 rows=237,760 loops=1)

23. 8.515 46.878 ↓ 1.0 46,995 1

Hash (cost=5,094.52..5,094.52 rows=46,255 width=16) (actual time=46.878..46.878 rows=46,995 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 2,715kB
24. 38.363 38.363 ↓ 1.0 46,995 1

Seq Scan on workflow (cost=0.00..5,094.52 rows=46,255 width=16) (actual time=0.007..38.363 rows=46,995 loops=1)

  • Filter: (project_id = 104)
  • Rows Removed by Filter: 190,087
25. 234.975 234.975 ↑ 2.0 2 46,995

Index Scan using vcl_version_idx on vcl (cost=0.43..2.51 rows=4 width=16) (actual time=0.004..0.005 rows=2 loops=46,995)

  • Index Cond: (version_id = version.id)
  • Filter: ((profile_id IS NULL) OR (profile_id = ANY ('{144,155,1492,1948,146,2012,149,147,153,150,1493,2286}'::bigint[])))
  • Rows Removed by Filter: 2
26. 0.021 0.131 ↑ 1.0 42 1

Hash (cost=61.44..61.44 rows=42 width=12) (actual time=0.131..0.131 rows=42 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
27. 0.017 0.110 ↑ 1.0 42 1

Nested Loop (cost=0.28..61.44 rows=42 width=12) (actual time=0.010..0.110 rows=42 loops=1)

28. 0.009 0.009 ↑ 1.0 42 1

Values Scan on "*VALUES*" (cost=0.00..0.53 rows=42 width=4) (actual time=0.002..0.009 rows=42 loops=1)

29. 0.084 0.084 ↑ 1.0 1 42

Index Only Scan using "actionPK" on action (cost=0.28..1.44 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=42)

  • Index Cond: (id = "*VALUES*".column1)
  • Heap Fetches: 0
30. 276.726 276.726 ↓ 0.0 0 138,363

Index Scan using pendency_situation_idx_1 on pendency_situation ps (cost=0.42..0.63 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=138,363)

  • Index Cond: (pendency_id = pendency.id)
  • Filter: ((status <> 0) AND ((office_id IS NULL) OR (office_id = 119)) AND (profile_id = ANY ('{144,155,1492,1948,146,2012,149,147,153,150,1493,2286}'::bigint[])))
  • Rows Removed by Filter: 2
31. 1.156 1.156 ↑ 1.0 1 1,156

Index Only Scan using "officePK" on office pendencysituationoffice (cost=0.28..0.32 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=1,156)

  • Index Cond: (id = ps.office_id)
  • Heap Fetches: 0
Planning time : 3.990 ms
Execution time : 1,071.421 ms