explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Ybdc

Settings
# exclusive inclusive rows x rows loops node
1. 0.022 247,381.018 ↓ 10.0 10 1

Limit (cost=46,000.29..46,000.33 rows=1 width=409) (actual time=247,380.911..247,381.018 rows=10 loops=1)

2. 0.074 247,380.996 ↓ 10.0 10 1

Unique (cost=46,000.29..46,000.33 rows=1 width=409) (actual time=247,380.910..247,380.996 rows=10 loops=1)

3. 43.139 247,380.922 ↓ 37.0 37 1

Sort (cost=46,000.29..46,000.29 rows=1 width=409) (actual time=247,380.909..247,380.922 rows=37 loops=1)

  • Sort Key: ah.creation DESC, ah.id, ah.content, ah.action_id, ah.logged_user_id, ah.step_after_id, ah.step_before_id, ah.workflow_id, ah.personified_by_id, ah.project_id, ah.action_execution_id, document.code, document.title, action.label, version.sequential
  • Sort Method: quicksort Memory: 3613kB
4. 1,855.891 247,337.783 ↓ 7,681.0 7,681 1

Nested Loop (cost=35,656.49..46,000.28 rows=1 width=409) (actual time=51,843.011..247,337.783 rows=7,681 loops=1)

  • Join Filter: ((document.id = document_1.id) AND (version.sequential = (min(version_1.sequential))))
  • Rows Removed by Join Filter: 15816575
5. 27,972.310 53,226.276 ↓ 25,984.0 25,984 1

Nested Loop (cost=12,665.08..23,008.82 rows=1 width=425) (actual time=382.247..53,226.276 rows=25,984 loops=1)

  • Join Filter: (version.id = vcl.version_id)
  • Rows Removed by Join Filter: 272768245
6. 210.081 997.990 ↓ 6,577.0 6,577 1

Nested Loop (cost=2,721.08..13,042.54 rows=1 width=433) (actual time=142.190..997.990 rows=6,577 loops=1)

  • Join Filter: (userproject.office_id = office.id)
  • Rows Removed by Join Filter: 1578480
7. 18.461 616.907 ↓ 6,577.0 6,577 1

Nested Loop (cost=2,721.08..13,035.12 rows=1 width=441) (actual time=142.163..616.907 rows=6,577 loops=1)

8. 120.320 532.676 ↓ 6,577.0 6,577 1

Nested Loop (cost=2,720.80..13,034.82 rows=1 width=449) (actual time=142.151..532.676 rows=6,577 loops=1)

  • Join Filter: (ah.logged_user_id = userproject.user_id)
  • Rows Removed by Join Filter: 828702
9. 0.241 0.241 ↑ 1.0 127 1

Seq Scan on user_project userproject (cost=0.00..15.29 rows=127 width=24) (actual time=0.032..0.241 rows=127 loops=1)

  • Filter: (config_item_group_id = 107)
  • Rows Removed by Filter: 536
10. 217.515 412.115 ↓ 2,192.3 6,577 127

Materialize (cost=2,720.80..13,013.82 rows=3 width=441) (actual time=0.131..3.245 rows=6,577 loops=127)

11. 6.665 194.600 ↓ 2,192.3 6,577 1

Nested Loop (cost=2,720.80..13,013.81 rows=3 width=441) (actual time=16.221..194.600 rows=6,577 loops=1)

12. 8.606 174.781 ↓ 939.6 6,577 1

Nested Loop (cost=2,720.52..13,011.56 rows=7 width=441) (actual time=16.213..174.781 rows=6,577 loops=1)

13. 52.041 119.911 ↓ 1,360.7 23,132 1

Hash Join (cost=2,720.24..13,006.37 rows=17 width=422) (actual time=16.189..119.911 rows=23,132 loops=1)

  • Hash Cond: (ah.workflow_id = version.workflow_id)
14. 51.709 51.709 ↑ 1.0 244,003 1

Seq Scan on action_history ah (cost=0.00..9,369.85 rows=244,285 width=305) (actual time=0.006..51.709 rows=244,003 loops=1)

15. 0.945 16.161 ↓ 984.5 1,969 1

Hash (cost=2,720.22..2,720.22 rows=2 width=117) (actual time=16.161..16.161 rows=1,969 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 383kB
16. 4.390 15.216 ↓ 984.5 1,969 1

Hash Join (cost=1,655.88..2,720.22 rows=2 width=117) (actual time=8.642..15.216 rows=1,969 loops=1)

  • Hash Cond: (version.document_id = document.id)
17. 2.739 2.739 ↑ 1.0 22,902 1

Seq Scan on version (cost=0.00..977.50 rows=23,150 width=28) (actual time=0.006..2.739 rows=22,902 loops=1)

18. 0.224 8.087 ↓ 609.0 609 1

Hash (cost=1,655.87..1,655.87 rows=1 width=89) (actual time=8.087..8.087 rows=609 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 101kB
19. 7.863 7.863 ↓ 609.0 609 1

Seq Scan on document (cost=0.00..1,655.87 rows=1 width=89) (actual time=0.742..7.863 rows=609 loops=1)

  • Filter: (((content ->> 'typeName'::text) = 'documentoProjeto'::text) AND (((content #> '{model,naturezaPR}'::text[]) ->> 'acronym'::text) = 'PP'::text))
  • Rows Removed by Filter: 13478
20. 46.264 46.264 ↓ 0.0 0 23,132

Index Scan using "actionPK" on action (cost=0.28..0.30 rows=1 width=27) (actual time=0.002..0.002 rows=0 loops=23,132)

  • Index Cond: (id = ah.action_id)
  • Filter: (action_type = 1)
  • Rows Removed by Filter: 1
21. 13.154 13.154 ↑ 1.0 1 6,577

Index Scan using "workflowPK" on workflow (cost=0.29..0.31 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=6,577)

  • Index Cond: (id = ah.workflow_id)
  • Filter: (project_id = 107)
22. 65.770 65.770 ↑ 1.0 1 6,577

Index Only Scan using "keep_userPK" on keep_user keepuser (cost=0.27..0.29 rows=1 width=8) (actual time=0.008..0.010 rows=1 loops=6,577)

  • Index Cond: (id = ah.logged_user_id)
  • Heap Fetches: 0
23. 171.002 171.002 ↑ 1.0 241 6,577

Seq Scan on office (cost=0.00..4.41 rows=241 width=8) (actual time=0.003..0.026 rows=241 loops=6,577)

24. 24,036.905 24,255.976 ↓ 46.6 41,477 6,577

Sort (cost=9,944.01..9,946.23 rows=891 width=48) (actual time=0.037..3.688 rows=41,477 loops=6,577)

  • Sort Key: vcl.version_id, vcl.profile_id
  • Sort Method: quicksort Memory: 4001kB
25. 92.066 219.071 ↓ 46.6 41,477 1

Hash Join (cost=1,801.98..9,900.35 rows=891 width=48) (actual time=29.709..219.071 rows=41,477 loops=1)

  • Hash Cond: (up.id = upp.user_project_id)
  • Join Filter: ((vcl.profile_id IS NULL) OR (vcl.profile_id = upp.profile_id))
  • Rows Removed by Join Filter: 407093
26. 65.878 126.401 ↓ 2.7 44,857 1

Hash Join (cost=1,753.40..8,772.65 rows=16,542 width=32) (actual time=29.082..126.401 rows=44,857 loops=1)

  • Hash Cond: (vcl.version_id = v.id)
  • Join Filter: ((vcl.office_id IS NULL) OR (vcl.office_id = up.office_id))
  • Rows Removed by Join Filter: 69856
27. 31.551 31.551 ↑ 1.0 286,633 1

Seq Scan on vcl (cost=0.00..5,423.36 rows=287,536 width=24) (actual time=0.011..31.551 rows=286,633 loops=1)

28. 3.179 28.972 ↓ 3.1 10,344 1

Hash (cost=1,711.73..1,711.73 rows=3,334 width=32) (actual time=28.972..28.972 rows=10,344 loops=1)

  • Buckets: 16384 (originally 4096) Batches: 1 (originally 1) Memory Usage: 775kB
29. 9.618 25.793 ↓ 3.1 10,344 1

Hash Join (cost=614.07..1,711.73 rows=3,334 width=32) (actual time=12.372..25.793 rows=10,344 loops=1)

  • Hash Cond: (v.workflow_id = w2.id)
30. 3.845 3.845 ↑ 1.0 22,902 1

Seq Scan on version v (cost=0.00..977.50 rows=23,150 width=16) (actual time=0.009..3.845 rows=22,902 loops=1)

31. 3.275 12.330 ↓ 3.0 10,344 1

Hash (cost=570.76..570.76 rows=3,465 width=32) (actual time=12.330..12.330 rows=10,344 loops=1)

  • Buckets: 16384 (originally 4096) Batches: 1 (originally 1) Memory Usage: 775kB
32. 5.854 9.055 ↓ 3.0 10,344 1

Hash Join (cost=15.30..570.76 rows=3,465 width=32) (actual time=0.134..9.055 rows=10,344 loops=1)

  • Hash Cond: (w2.project_id = up.config_item_group_id)
33. 3.111 3.111 ↑ 1.0 22,919 1

Seq Scan on workflow w2 (cost=0.00..430.59 rows=24,059 width=16) (actual time=0.011..3.111 rows=22,919 loops=1)

34. 0.005 0.090 ↑ 1.0 1 1

Hash (cost=15.29..15.29 rows=1 width=32) (actual time=0.090..0.090 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
35. 0.085 0.085 ↑ 1.0 1 1

Seq Scan on user_project up (cost=0.00..15.29 rows=1 width=32) (actual time=0.030..0.085 rows=1 loops=1)

  • Filter: (user_id = 7050)
  • Rows Removed by Filter: 662
36. 0.304 0.604 ↑ 1.0 1,670 1

Hash (cost=27.70..27.70 rows=1,670 width=16) (actual time=0.604..0.604 rows=1,670 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 95kB
37. 0.300 0.300 ↑ 1.0 1,670 1

Seq Scan on user_project_profile upp (cost=0.00..27.70 rows=1,670 width=16) (actual time=0.008..0.300 rows=1,670 loops=1)

38. 87,721.984 192,255.616 ↓ 609.0 609 25,984

GroupAggregate (cost=22,991.41..22,991.43 rows=1 width=12) (actual time=1.994..7.399 rows=609 loops=25,984)

  • Group Key: document_1.id
39. 53,089.188 104,533.632 ↓ 25,984.0 25,984 25,984

Sort (cost=22,991.41..22,991.41 rows=1 width=12) (actual time=1.981..4.023 rows=25,984 loops=25,984)

  • Sort Key: document_1.id
  • Sort Method: quicksort Memory: 1987kB
40. 27,794.443 51,444.444 ↓ 25,984.0 25,984 1

Nested Loop (cost=12,682.53..22,991.40 rows=1 width=12) (actual time=229.478..51,444.444 rows=25,984 loops=1)

  • Join Filter: (version_1.id = vcl_1.version_id)
  • Rows Removed by Join Filter: 272768245
41. 3.804 373.998 ↓ 6,577.0 6,577 1

Nested Loop (cost=2,738.52..13,025.12 rows=1 width=20) (actual time=24.626..373.998 rows=6,577 loops=1)

42. 5.844 337.309 ↓ 6,577.0 6,577 1

Nested Loop (cost=2,738.37..13,024.88 rows=1 width=28) (actual time=24.621..337.309 rows=6,577 loops=1)

43. 32.810 305.157 ↓ 6,577.0 6,577 1

Nested Loop (cost=2,738.10..13,024.58 rows=1 width=44) (actual time=24.614..305.157 rows=6,577 loops=1)

44. 17.293 179.819 ↓ 11,566.0 23,132 1

Hash Join (cost=2,737.83..13,023.97 rows=2 width=52) (actual time=24.607..179.819 rows=23,132 loops=1)

  • Hash Cond: (ah_1.logged_user_id = userproject_1.user_id)
45. 68.178 162.339 ↓ 3,304.6 23,132 1

Hash Join (cost=2,720.95..13,006.97 rows=7 width=44) (actual time=24.409..162.339 rows=23,132 loops=1)

  • Hash Cond: (ah_1.workflow_id = workflow_1.id)
46. 69.805 69.805 ↑ 1.0 244,003 1

Seq Scan on action_history ah_1 (cost=0.00..9,369.85 rows=244,285 width=24) (actual time=0.014..69.805 rows=244,003 loops=1)

47. 0.548 24.356 ↓ 1,969.0 1,969 1

Hash (cost=2,720.94..2,720.94 rows=1 width=44) (actual time=24.356..24.356 rows=1,969 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 170kB
48. 0.306 23.808 ↓ 1,969.0 1,969 1

Nested Loop (cost=1,656.17..2,720.94 rows=1 width=44) (actual time=13.255..23.808 rows=1,969 loops=1)

49. 4.063 19.564 ↓ 984.5 1,969 1

Hash Join (cost=1,655.88..2,720.22 rows=2 width=28) (actual time=13.238..19.564 rows=1,969 loops=1)

  • Hash Cond: (version_1.document_id = document_1.id)
50. 2.757 2.757 ↑ 1.0 22,902 1

Seq Scan on version version_1 (cost=0.00..977.50 rows=23,150 width=28) (actual time=0.007..2.757 rows=22,902 loops=1)

51. 0.182 12.744 ↓ 609.0 609 1

Hash (cost=1,655.87..1,655.87 rows=1 width=8) (actual time=12.744..12.744 rows=609 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 32kB
52. 12.562 12.562 ↓ 609.0 609 1

Seq Scan on document document_1 (cost=0.00..1,655.87 rows=1 width=8) (actual time=1.090..12.562 rows=609 loops=1)

  • Filter: (((content ->> 'typeName'::text) = 'documentoProjeto'::text) AND (((content #> '{model,naturezaPR}'::text[]) ->> 'acronym'::text) = 'PP'::text))
  • Rows Removed by Filter: 13478
53. 3.938 3.938 ↑ 1.0 1 1,969

Index Scan using "workflowPK" on workflow workflow_1 (cost=0.29..0.35 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=1,969)

  • Index Cond: (id = version_1.workflow_id)
  • Filter: (project_id = 107)
54. 0.040 0.187 ↑ 1.0 127 1

Hash (cost=15.29..15.29 rows=127 width=24) (actual time=0.187..0.187 rows=127 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
55. 0.147 0.147 ↑ 1.0 127 1

Seq Scan on user_project userproject_1 (cost=0.00..15.29 rows=127 width=24) (actual time=0.065..0.147 rows=127 loops=1)

  • Filter: (config_item_group_id = 107)
  • Rows Removed by Filter: 536
56. 92.528 92.528 ↓ 0.0 0 23,132

Index Scan using "actionPK" on action action_1 (cost=0.28..0.30 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=23,132)

  • Index Cond: (id = ah_1.action_id)
  • Filter: (action_type = 1)
  • Rows Removed by Filter: 1
57. 26.308 26.308 ↑ 1.0 1 6,577

Index Only Scan using "keep_userPK" on keep_user keepuser_1 (cost=0.27..0.29 rows=1 width=8) (actual time=0.003..0.004 rows=1 loops=6,577)

  • Index Cond: (id = ah_1.logged_user_id)
  • Heap Fetches: 0
58. 32.885 32.885 ↑ 1.0 1 6,577

Index Only Scan using "officePK" on office office_1 (cost=0.14..0.23 rows=1 width=8) (actual time=0.002..0.005 rows=1 loops=6,577)

  • Index Cond: (id = userproject_1.office_id)
  • Heap Fetches: 0
59. 23,089.057 23,276.003 ↓ 46.6 41,477 6,577

Sort (cost=9,944.01..9,946.23 rows=891 width=48) (actual time=0.032..3.539 rows=41,477 loops=6,577)

  • Sort Key: vcl_1.version_id, vcl_1.profile_id
  • Sort Method: quicksort Memory: 4001kB
60. 83.985 186.946 ↓ 46.6 41,477 1

Hash Join (cost=1,801.98..9,900.35 rows=891 width=48) (actual time=21.408..186.946 rows=41,477 loops=1)

  • Hash Cond: (up_1.id = upp_1.user_project_id)
  • Join Filter: ((vcl_1.profile_id IS NULL) OR (vcl_1.profile_id = upp_1.profile_id))
  • Rows Removed by Join Filter: 407093
61. 55.101 102.547 ↓ 2.7 44,857 1

Hash Join (cost=1,753.40..8,772.65 rows=16,542 width=32) (actual time=20.979..102.547 rows=44,857 loops=1)

  • Hash Cond: (vcl_1.version_id = v_1.id)
  • Join Filter: ((vcl_1.office_id IS NULL) OR (vcl_1.office_id = up_1.office_id))
  • Rows Removed by Join Filter: 69856
62. 26.547 26.547 ↑ 1.0 286,633 1

Seq Scan on vcl vcl_1 (cost=0.00..5,423.36 rows=287,536 width=24) (actual time=0.007..26.547 rows=286,633 loops=1)

63. 2.237 20.899 ↓ 3.1 10,344 1

Hash (cost=1,711.73..1,711.73 rows=3,334 width=32) (actual time=20.899..20.899 rows=10,344 loops=1)

  • Buckets: 16384 (originally 4096) Batches: 1 (originally 1) Memory Usage: 775kB
64. 6.744 18.662 ↓ 3.1 10,344 1

Hash Join (cost=614.07..1,711.73 rows=3,334 width=32) (actual time=8.776..18.662 rows=10,344 loops=1)

  • Hash Cond: (v_1.workflow_id = w2_1.id)
65. 3.158 3.158 ↑ 1.0 22,902 1

Seq Scan on version v_1 (cost=0.00..977.50 rows=23,150 width=16) (actual time=0.005..3.158 rows=22,902 loops=1)

66. 1.888 8.760 ↓ 3.0 10,344 1

Hash (cost=570.76..570.76 rows=3,465 width=32) (actual time=8.760..8.760 rows=10,344 loops=1)

  • Buckets: 16384 (originally 4096) Batches: 1 (originally 1) Memory Usage: 775kB
67. 4.651 6.872 ↓ 3.0 10,344 1

Hash Join (cost=15.30..570.76 rows=3,465 width=32) (actual time=0.115..6.872 rows=10,344 loops=1)

  • Hash Cond: (w2_1.project_id = up_1.config_item_group_id)
68. 2.140 2.140 ↑ 1.0 22,919 1

Seq Scan on workflow w2_1 (cost=0.00..430.59 rows=24,059 width=16) (actual time=0.013..2.140 rows=22,919 loops=1)

69. 0.001 0.081 ↑ 1.0 1 1

Hash (cost=15.29..15.29 rows=1 width=32) (actual time=0.081..0.081 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
70. 0.080 0.080 ↑ 1.0 1 1

Seq Scan on user_project up_1 (cost=0.00..15.29 rows=1 width=32) (actual time=0.028..0.080 rows=1 loops=1)

  • Filter: (user_id = 7050)
  • Rows Removed by Filter: 662
71. 0.209 0.414 ↑ 1.0 1,670 1

Hash (cost=27.70..27.70 rows=1,670 width=16) (actual time=0.413..0.414 rows=1,670 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 95kB
72. 0.205 0.205 ↑ 1.0 1,670 1

Seq Scan on user_project_profile upp_1 (cost=0.00..27.70 rows=1,670 width=16) (actual time=0.010..0.205 rows=1,670 loops=1)