explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yoHW

Settings
# exclusive inclusive rows x rows loops node
1. 0.044 1,204.381 ↓ 2.0 2 1

Sort (cost=18,468.01..18,468.02 rows=1 width=858) (actual time=1,204.381..1,204.381 rows=2 loops=1)

  • Sort Key: document_files.anchor DESC, document_files.name, document_file_versions.filename, document_files.time_deleted DESC, document_files.id, document_file_versions.id
  • Sort Method: quicksort Memory: 25kB
2. 0.025 1,204.337 ↓ 2.0 2 1

Nested Loop Left Join (cost=19.29..18,468.00 rows=1 width=858) (actual time=914.009..1,204.337 rows=2 loops=1)

  • Join Filter: (document_file_version_drafts.document_file_version_id = document_file_versions.id)
  • Rows Removed by Join Filter: 74
3. 0.018 1,204.048 ↓ 2.0 2 1

Nested Loop (cost=19.29..18,442.86 rows=1 width=834) (actual time=913.864..1,204.048 rows=2 loops=1)

  • Join Filter: (document_files.id = (t1.folder_path_ids[2]))
  • Rows Removed by Join Filter: 17
4. 0.049 1,203.880 ↓ 10.0 10 1

Nested Loop Left Join (cost=3.50..18,426.94 rows=1 width=831) (actual time=257.233..1,203.880 rows=10 loops=1)

5. 0.041 0.041 ↓ 10.0 10 1

Index Scan using document_files_parent_id_index on document_files (cost=0.42..4.16 rows=1 width=51) (actual time=0.010..0.041 rows=10 loops=1)

  • Index Cond: (parent_id = 112,198)
  • Filter: (((time_deleted IS NULL) OR (time_deleted >= '2020-10-13 08:32:43.854319+00'::timestamp with time zone)) AND (organization_id = 2))
  • Rows Removed by Filter: 2
6. 91.890 1,203.790 ↓ 0.0 0 10

Hash Right Join (cost=3.08..18,422.77 rows=1 width=784) (actual time=119.711..120.379 rows=0 loops=10)

  • Hash Cond: (document_file_version_user_actions.document_file_version_id = document_file_versions.id)
7. 825.932 1,111.800 ↓ 1.2 273,787 4

GroupAggregate (cost=0.42..15,545.68 rows=227,677 width=8) (actual time=0.027..277.950 rows=273,787 loops=4)

  • Group Key: document_file_version_user_actions.document_file_version_id
8. 285.868 285.868 ↑ 1.1 300,599 4

Index Scan using document_file_version_user_actions_document_file_version_id_ind on document_file_version_user_actions (cost=0.42..9,617.52 rows=324,568 width=19) (actual time=0.009..71.467 rows=300,599 loops=4)

9. 0.020 0.100 ↓ 0.0 0 10

Hash (cost=2.64..2.64 rows=1 width=780) (actual time=0.010..0.010 rows=0 loops=10)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
10. 0.080 0.080 ↓ 0.0 0 10

Index Scan using document_file_versions_document_file_id_index on document_file_versions (cost=0.42..2.64 rows=1 width=780) (actual time=0.007..0.008 rows=0 loops=10)

  • Index Cond: (document_file_id = document_files.id)
  • Filter: (latest_version IS TRUE)
  • Rows Removed by Filter: 1
11. 0.030 0.150 ↑ 1.5 2 10

GroupAggregate (cost=15.79..15.86 rows=3 width=7) (actual time=0.014..0.015 rows=2 loops=10)

  • Group Key: (t1.folder_path_ids[2])
12. 0.019 0.120 ↑ 1.5 2 10

Sort (cost=15.79..15.80 rows=3 width=8) (actual time=0.012..0.012 rows=2 loops=10)

  • Sort Key: (t1.folder_path_ids[2])
  • Sort Method: quicksort Memory: 25kB
13. 0.002 0.101 ↑ 1.5 2 1

Subquery Scan on t1 (cost=15.71..15.77 rows=3 width=8) (actual time=0.100..0.101 rows=2 loops=1)

14. 0.011 0.099 ↑ 1.5 2 1

HashAggregate (cost=15.71..15.74 rows=3 width=72) (actual time=0.099..0.099 rows=2 loops=1)

  • Group Key: document_rights.id, document_rights.team_id, document_rights.user_id, document_rights.folder_path_ids, document_rights.can_view, document_rights.can_edit, document_rights.can_manage, document_rights.time_created, document_rights.created_by, document_rights.time_updated, document_rights.updated_by, ((array_length(document_rights.folder_path_ids, 1) = 2))
15. 0.001 0.088 ↑ 1.5 2 1

Append (cost=13.14..15.62 rows=3 width=72) (actual time=0.078..0.088 rows=2 loops=1)

16. 0.002 0.079 ↑ 1.0 2 1

Unique (cost=13.14..13.20 rows=2 width=72) (actual time=0.078..0.079 rows=2 loops=1)

17. 0.017 0.077 ↑ 1.0 2 1

Sort (cost=13.14..13.14 rows=2 width=72) (actual time=0.077..0.077 rows=2 loops=1)

  • Sort Key: document_rights.id, document_rights.team_id, document_rights.user_id, document_rights.folder_path_ids, document_rights.can_view, document_rights.can_edit, document_rights.can_manage, document_rights.time_created, document_rights.created_by, document_rights.time_updated, document_rights.updated_by, ((array_length(document_rights.folder_path_ids, 1) = 2))
  • Sort Method: quicksort Memory: 25kB
18. 0.001 0.060 ↑ 1.0 2 1

Append (cost=4.42..13.13 rows=2 width=72) (actual time=0.034..0.060 rows=2 loops=1)

19. 0.012 0.038 ↓ 2.0 2 1

Bitmap Heap Scan on document_rights (cost=4.42..7.75 rows=1 width=68) (actual time=0.033..0.038 rows=2 loops=1)

  • Recheck Cond: ('{112198}'::integer[] <@ folder_path_ids)
  • Filter: ((can_view OR can_manage) AND (team_id = 31))
  • Rows Removed by Filter: 5
  • Heap Blocks: exact=4
20. 0.026 0.026 ↓ 2.7 8 1

Bitmap Index Scan on idx_folder_path_ids_gin (cost=0.00..4.42 rows=3 width=0) (actual time=0.026..0.026 rows=8 loops=1)

  • Index Cond: ('{112198}'::integer[] <@ folder_path_ids)
21. 0.000 0.021 ↓ 0.0 0 1

Nested Loop (cost=0.54..5.36 rows=1 width=68) (actual time=0.021..0.021 rows=0 loops=1)

22. 0.000 0.021 ↓ 0.0 0 1

Nested Loop (cost=0.15..3.87 rows=1 width=8) (actual time=0.021..0.021 rows=0 loops=1)

23. 0.021 0.021 ↓ 0.0 0 1

Seq Scan on team_users (cost=0.00..1.50 rows=1 width=4) (actual time=0.021..0.021 rows=0 loops=1)

  • Filter: (user_id = 5)
  • Rows Removed by Filter: 40
24. 0.000 0.000 ↓ 0.0 0

Index Only Scan using teams_pkey on teams (cost=0.15..2.37 rows=1 width=4) (never executed)

  • Index Cond: (id = team_users.team_id)
  • Heap Fetches: 0
25. 0.000 0.000 ↓ 0.0 0

Index Scan using document_rights_team_id_md5_idx on document_rights document_rights_1 (cost=0.39..1.47 rows=1 width=67) (never executed)

  • Index Cond: (team_id = teams.id)
  • Filter: ((can_view OR can_manage) AND ('{112198}'::integer[] <@ folder_path_ids))
26. 0.000 0.008 ↓ 0.0 0 1

Bitmap Heap Scan on document_rights document_rights_2 (cost=1.25..2.37 rows=1 width=68) (actual time=0.008..0.008 rows=0 loops=1)

  • Recheck Cond: (user_id = 5)
  • Filter: ((can_view OR can_manage) AND ('{112198}'::integer[] <@ folder_path_ids))
27. 0.008 0.008 ↓ 0.0 0 1

Bitmap Index Scan on document_rights_user_id_md5_idx (cost=0.00..1.25 rows=1 width=0) (actual time=0.008..0.008 rows=0 loops=1)

  • Index Cond: (user_id = 5)
28. 0.264 0.264 ↑ 1.1 37 2

Seq Scan on document_file_version_drafts (cost=0.00..24.65 rows=39 width=28) (actual time=0.011..0.132 rows=37 loops=2)

  • Filter: (deleted IS FALSE)
  • Rows Removed by Filter: 532
Planning time : 4.039 ms
Execution time : 1,204.885 ms