explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sR1R

Settings
# exclusive inclusive rows x rows loops node
1. 2.123 1,276.210 ↓ 687.0 687 1

Sort (cost=21,835.47..21,835.47 rows=1 width=51) (actual time=1,276.181..1,276.210 rows=687 loops=1)

  • Sort Key: document.code, version.sequential
  • Sort Method: quicksort Memory: 109kB
2. 1.749 1,274.087 ↓ 687.0 687 1

Nested Loop (cost=30.97..21,835.46 rows=1 width=51) (actual time=3.430..1,274.087 rows=687 loops=1)

  • Join Filter: (pendency.action_id = "*VALUES*".column1)
  • Rows Removed by Join Filter: 28,167
3. 217.018 1,269.590 ↓ 687.0 687 1

Nested Loop Left Join (cost=30.97..21,834.41 rows=1 width=59) (actual time=3.424..1,269.590 rows=687 loops=1)

  • Join Filter: (((workflow.current_step_id = am.workflow_step_id) OR (am.workflow_step_id IS NULL)) AND (am.action_id = pendency.action_id))
  • Rows Removed by Join Filter: 1,911,973
4. 0.471 946.552 ↓ 684.0 684 1

Nested Loop (cost=30.97..21,587.51 rows=1 width=59) (actual time=2.985..946.552 rows=684 loops=1)

  • Join Filter: (ps.profile_id = profile.id)
  • Rows Removed by Join Filter: 7,836
5. 0.000 945.371 ↓ 26.3 710 1

Nested Loop (cost=30.69..21,547.05 rows=27 width=67) (actual time=2.967..945.371 rows=710 loops=1)

6. 0.000 931.960 ↓ 11.1 3,419 1

Nested Loop (cost=30.27..21,216.80 rows=307 width=59) (actual time=0.436..931.960 rows=3,419 loops=1)

7. 149.067 759.439 ↓ 52.7 46,995 1

Nested Loop (cost=29.84..20,655.94 rows=892 width=59) (actual time=0.335..759.439 rows=46,995 loops=1)

8. 63.471 373.302 ↓ 51.8 237,070 1

Nested Loop (cost=29.42..18,383.41 rows=4,574 width=43) (actual time=0.283..373.302 rows=237,070 loops=1)

9. 32.903 64.285 ↓ 52.0 122,773 1

Hash Join (cost=29.00..16,541.93 rows=2,362 width=39) (actual time=0.274..64.285 rows=122,773 loops=1)

  • Hash Cond: ((document.office_id = office_project.office_id) AND (document.project_id = office_project.config_item_group_id))
10. 31.122 31.122 ↑ 1.0 122,775 1

Seq Scan on document (cost=0.00..14,340.75 rows=122,775 width=51) (actual time=0.008..31.122 rows=122,775 loops=1)

11. 0.132 0.260 ↑ 1.0 840 1

Hash (cost=16.40..16.40 rows=840 width=20) (actual time=0.260..0.260 rows=840 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 55kB
12. 0.128 0.128 ↑ 1.0 840 1

Seq Scan on office_project (cost=0.00..16.40 rows=840 width=20) (actual time=0.005..0.128 rows=840 loops=1)

13. 245.546 245.546 ↑ 1.5 2 122,773

Index Scan using version_document_id_idx on version (cost=0.42..0.75 rows=3 width=20) (actual time=0.002..0.002 rows=2 loops=122,773)

  • Index Cond: (document_id = document.id)
14. 237.070 237.070 ↓ 0.0 0 237,070

Index Scan using "workflowPK" on workflow (cost=0.42..0.49 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=237,070)

  • Index Cond: (id = version.workflow_id)
  • Filter: (project_id = 104)
  • Rows Removed by Filter: 1
15. 187.980 187.980 ↓ 0.0 0 46,995

Index Scan using pendency_workflow_id_idx on pendency (cost=0.42..0.62 rows=1 width=24) (actual time=0.003..0.004 rows=0 loops=46,995)

  • Index Cond: (workflow_id = version.workflow_id)
  • Filter: (status <> 0)
  • Rows Removed by Filter: 3
16. 13.676 13.676 ↓ 0.0 0 3,419

Index Scan using pendency_situation_idx_1 on pendency_situation ps (cost=0.42..1.07 rows=1 width=16) (actual time=0.003..0.004 rows=0 loops=3,419)

  • Index Cond: (pendency_id = pendency.id)
  • Filter: ((office_id IS NULL) OR (office_id = 119))
  • Rows Removed by Filter: 1
17. 0.688 0.710 ↑ 1.0 12 710

Materialize (cost=0.28..35.63 rows=12 width=8) (actual time=0.000..0.001 rows=12 loops=710)

18. 0.022 0.022 ↑ 1.0 12 1

Index Only Scan using "profilePK" on profile (cost=0.28..35.57 rows=12 width=8) (actual time=0.003..0.022 rows=12 loops=1)

  • Index Cond: (id = ANY ('{144,155,1492,1948,146,2012,149,147,153,150,1493,2286}'::bigint[]))
  • Heap Fetches: 0
19. 106.020 106.020 ↑ 1.0 2,796 684

Seq Scan on action_metadata am (cost=0.00..204.96 rows=2,796 width=24) (actual time=0.000..0.155 rows=2,796 loops=684)

20. 2.748 2.748 ↑ 1.0 42 687

Values Scan on "*VALUES*" (cost=0.00..0.53 rows=42 width=4) (actual time=0.000..0.004 rows=42 loops=687)

Planning time : 2.386 ms
Execution time : 1,276.316 ms