explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nQ2C

Settings
# exclusive inclusive rows x rows loops node
1. 34.304 34.304 ↑ 883,103.0 1 1

CTE Scan on alldata (cost=160,360.91..178,022.97 rows=883,103 width=16) (actual time=34.303..34.304 rows=1 loops=1)

2.          

CTE cdata

3. 0.002 0.017 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.29..13.03 rows=147 width=48) (actual time=0.017..0.017 rows=0 loops=1)

4. 0.015 0.015 ↓ 0.0 0 1

Seq Scan on contractors c (cost=0.00..4.72 rows=1 width=32) (actual time=0.015..0.015 rows=0 loops=1)

  • Filter: ((organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid) AND (contractor_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[])))
  • Rows Removed by Filter: 86
5. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_contractors on contract_items ci (cost=0.29..8.30 rows=1 width=32) (never executed)

  • Index Cond: (c.contractor_id = contractor_id)
6.          

CTE cudata

7. 0.001 0.025 ↓ 0.0 0 1

Nested Loop (cost=4.92..467.87 rows=1 width=32) (actual time=0.025..0.025 rows=0 loops=1)

8. 0.011 0.024 ↓ 0.0 0 1

Hash Join (cost=4.78..467.53 rows=2 width=48) (actual time=0.024..0.024 rows=0 loops=1)

  • Hash Cond: (ci_1.user_id = cdata.user_id)
9. 0.012 0.012 ↑ 12,635.0 1 1

Seq Scan on contract_items ci_1 (cost=0.00..415.35 rows=12,635 width=48) (actual time=0.012..0.012 rows=1 loops=1)

10. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=2.94..2.94 rows=147 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
11. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on cdata (cost=0.00..2.94 rows=147 width=16) (actual time=0.000..0.000 rows=0 loops=1)

12. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contract on contracts c_1 (cost=0.14..0.17 rows=1 width=16) (never executed)

  • Index Cond: (contract_id = ci_1.contract_id)
  • Filter: (organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid)
13.          

CTE tcdata

14. 0.006 0.018 ↓ 0.0 0 1

Hash Right Join (cost=25.63..488.37 rows=12,635 width=64) (actual time=0.018..0.018 rows=0 loops=1)

  • Hash Cond: (ci_2.crew_id = t.crew_id)
15. 0.000 0.000 ↓ 0.0 0

Seq Scan on contract_items ci_2 (cost=0.00..415.35 rows=12,635 width=32) (never executed)

16. 0.001 0.012 ↓ 0.0 0 1

Hash (cost=20.85..20.85 rows=382 width=48) (actual time=0.012..0.012 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
17. 0.006 0.011 ↓ 0.0 0 1

Hash Join (cost=4.78..20.85 rows=382 width=48) (actual time=0.011..0.011 rows=0 loops=1)

  • Hash Cond: (t.contractor_id = cdata_1.contractor_id)
18. 0.004 0.004 ↑ 382.0 1 1

Seq Scan on crews t (cost=0.00..10.82 rows=382 width=48) (actual time=0.004..0.004 rows=1 loops=1)

19. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=2.94..2.94 rows=147 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
20. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on cdata cdata_1 (cost=0.00..2.94 rows=147 width=16) (actual time=0.000..0.000 rows=0 loops=1)

21.          

CTE tcudata

22. 0.046 1.422 ↓ 0.0 0 1

Hash Join (cost=418.34..1,465.87 rows=3 width=32) (actual time=1.422..1.422 rows=0 loops=1)

  • Hash Cond: (ci_3.user_id = tcdata.user_id)
23. 0.670 1.375 ↑ 299.0 1 1

Hash Join (cost=7.70..582.03 rows=299 width=32) (actual time=1.375..1.375 rows=1 loops=1)

  • Hash Cond: (ci_3.contract_id = c_2.contract_id)
24. 0.678 0.678 ↑ 1.2 10,234 1

Seq Scan on contract_items ci_3 (cost=0.00..415.35 rows=12,635 width=48) (actual time=0.003..0.678 rows=10,234 loops=1)

25. 0.002 0.027 ↑ 1.0 5 1

Hash (cost=7.64..7.64 rows=5 width=16) (actual time=0.027..0.027 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
26. 0.025 0.025 ↑ 1.0 5 1

Seq Scan on contracts c_2 (cost=0.00..7.64 rows=5 width=16) (actual time=0.022..0.025 rows=5 loops=1)

  • Filter: (organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid)
  • Rows Removed by Filter: 207
27. 0.000 0.001 ↓ 0.0 0 1

Hash (cost=252.70..252.70 rows=12,635 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 128kB
28. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on tcdata (cost=0.00..252.70 rows=12,635 width=16) (actual time=0.001..0.001 rows=0 loops=1)

29.          

CTE tdata

30. 0.000 0.100 ↓ 0.0 0 1

Nested Loop Left Join (cost=4.42..26.21 rows=33 width=64) (actual time=0.100..0.100 rows=0 loops=1)

31. 0.003 0.100 ↓ 0.0 0 1

Hash Join (cost=4.14..17.90 rows=1 width=48) (actual time=0.100..0.100 rows=0 loops=1)

  • Hash Cond: (t_1.contractor_id = c_3.contractor_id)
32. 0.097 0.097 ↓ 0.0 0 1

Seq Scan on crews t_1 (cost=0.00..13.69 rows=6 width=48) (actual time=0.097..0.097 rows=0 loops=1)

  • Filter: (crew_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[]))
  • Rows Removed by Filter: 382
33. 0.000 0.000 ↓ 0.0 0

Hash (cost=4.08..4.08 rows=5 width=16) (never executed)

34. 0.000 0.000 ↓ 0.0 0

Seq Scan on contractors c_3 (cost=0.00..4.08 rows=5 width=16) (never executed)

  • Filter: (organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid)
35. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_crews on contract_items ci_4 (cost=0.29..8.30 rows=1 width=32) (never executed)

  • Index Cond: (t_1.crew_id = crew_id)
36.          

CTE tudata

37. 0.000 0.001 ↓ 0.0 0 1

Nested Loop (cost=0.43..231.31 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

38. 0.001 0.001 ↓ 0.0 0 1

Nested Loop (cost=0.29..230.97 rows=2 width=48) (actual time=0.001..0.001 rows=0 loops=1)

39. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on tdata (cost=0.00..0.66 rows=33 width=16) (actual time=0.000..0.000 rows=0 loops=1)

40. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_users on contract_items ci_5 (cost=0.29..6.97 rows=1 width=48) (never executed)

  • Index Cond: (user_id = tdata.user_id)
41. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contract on contracts c_4 (cost=0.14..0.17 rows=1 width=16) (never executed)

  • Index Cond: (contract_id = ci_5.contract_id)
  • Filter: (organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid)
42.          

CTE trdata

43. 0.013 0.033 ↓ 0.0 0 1

Hash Join (cost=542.71..1,016.46 rows=1,115 width=48) (actual time=0.033..0.033 rows=0 loops=1)

  • Hash Cond: (ci_6.crews_discipline_rates_id = cdr.crews_discipline_rates_id)
44. 0.009 0.009 ↑ 12,635.0 1 1

Seq Scan on contract_items ci_6 (cost=0.00..415.35 rows=12,635 width=32) (actual time=0.009..0.009 rows=1 loops=1)

45. 0.000 0.011 ↓ 0.0 0 1

Hash (cost=521.42..521.42 rows=1,703 width=32) (actual time=0.011..0.011 rows=0 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 16kB
46. 0.004 0.011 ↓ 0.0 0 1

Hash Join (cost=1.07..521.42 rows=1,703 width=32) (actual time=0.011..0.011 rows=0 loops=1)

  • Hash Cond: (cdr.crew_id = tdata_1.crew_id)
47. 0.006 0.006 ↑ 19,296.0 1 1

Seq Scan on crews_discipline_rates cdr (cost=0.00..430.96 rows=19,296 width=32) (actual time=0.006..0.006 rows=1 loops=1)

48. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=0.66..0.66 rows=33 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
49. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on tdata tdata_1 (cost=0.00..0.66 rows=33 width=16) (actual time=0.000..0.000 rows=0 loops=1)

50.          

CTE tcrdata

51. 0.005 11.353 ↓ 0.0 0 1

Merge Join (cost=3,175.67..9,641.66 rows=426,854 width=48) (actual time=11.353..11.353 rows=0 loops=1)

  • Merge Cond: (cdr_1.crew_id = tcdata_1.crew_id)
52. 2.872 11.334 ↑ 12,635.0 1 1

Sort (cost=2,062.21..2,093.79 rows=12,635 width=48) (actual time=11.334..11.334 rows=1 loops=1)

  • Sort Key: cdr_1.crew_id
  • Sort Method: quicksort Memory: 1360kB
53. 3.109 8.462 ↑ 1.0 12,483 1

Hash Join (cost=573.29..1,201.44 rows=12,635 width=48) (actual time=3.814..8.462 rows=12,483 loops=1)

  • Hash Cond: (cdr_1.crews_discipline_rates_id = ci_7.crews_discipline_rates_id)
54. 1.579 1.579 ↑ 1.0 19,296 1

Seq Scan on crews_discipline_rates cdr_1 (cost=0.00..430.96 rows=19,296 width=32) (actual time=0.004..1.579 rows=19,296 loops=1)

55. 1.377 3.774 ↑ 1.0 12,483 1

Hash (cost=415.35..415.35 rows=12,635 width=32) (actual time=3.774..3.774 rows=12,483 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 909kB
56. 2.397 2.397 ↓ 1.0 12,637 1

Seq Scan on contract_items ci_7 (cost=0.00..415.35 rows=12,635 width=32) (actual time=0.004..2.397 rows=12,637 loops=1)

57. 0.013 0.014 ↓ 0.0 0 1

Sort (cost=1,113.47..1,145.06 rows=12,635 width=16) (actual time=0.014..0.014 rows=0 loops=1)

  • Sort Key: tcdata_1.crew_id
  • Sort Method: quicksort Memory: 25kB
58. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on tcdata tcdata_1 (cost=0.00..252.70 rows=12,635 width=16) (actual time=0.001..0.001 rows=0 loops=1)

59.          

CTE pdata

60. 0.005 0.060 ↑ 16.0 1 1

Merge Right Join (cost=33.29..33.41 rows=16 width=32) (actual time=0.059..0.060 rows=1 loops=1)

  • Merge Cond: (ci_8.project_id = p.project_id)
61. 0.021 0.021 ↑ 4,211.7 3 1

Index Scan using fki_contract_items_projects on contract_items ci_8 (cost=0.29..629.81 rows=12,635 width=32) (actual time=0.019..0.021 rows=3 loops=1)

62. 0.003 0.034 ↑ 1.0 1 1

Sort (cost=33.01..33.01 rows=1 width=16) (actual time=0.034..0.034 rows=1 loops=1)

  • Sort Key: p.project_id
  • Sort Method: quicksort Memory: 25kB
63. 0.007 0.031 ↑ 1.0 1 1

Bitmap Heap Scan on projects p (cost=17.70..33.00 rows=1 width=16) (actual time=0.031..0.031 rows=1 loops=1)

  • Recheck Cond: (project_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[]))
  • Filter: (organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid)
  • Heap Blocks: exact=1
64. 0.024 0.024 ↑ 6.0 1 1

Bitmap Index Scan on pk_projects (cost=0.00..17.70 rows=6 width=0) (actual time=0.024..0.024 rows=1 loops=1)

  • Index Cond: (project_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[]))
65.          

CTE ddata

66. 0.022 0.145 ↓ 0.0 0 1

Merge Join (cost=168.87..183.97 rows=11 width=64) (actual time=0.145..0.145 rows=0 loops=1)

  • Merge Cond: (ci_9.organizations_disciplines_id = d.organizations_disciplines_id)
67. 0.042 0.042 ↑ 119.2 106 1

Index Scan using fki_contract_items_organizations_disciplines on contract_items ci_9 (cost=0.29..1,492.97 rows=12,635 width=32) (actual time=0.008..0.042 rows=106 loops=1)

68. 0.007 0.081 ↑ 10.8 5 1

Sort (cost=168.59..168.72 rows=54 width=48) (actual time=0.080..0.081 rows=5 loops=1)

  • Sort Key: d.organizations_disciplines_id
  • Sort Method: quicksort Memory: 25kB
69. 0.015 0.074 ↑ 10.8 5 1

Bitmap Heap Scan on disciplines d (cost=51.82..167.03 rows=54 width=48) (actual time=0.068..0.074 rows=5 loops=1)

  • Recheck Cond: ((project_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[])) OR (discipline_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[])))
  • Heap Blocks: exact=4
70. 0.000 0.059 ↓ 0.0 0 1

BitmapOr (cost=51.82..51.82 rows=54 width=0) (actual time=0.059..0.059 rows=0 loops=1)

71. 0.033 0.033 ↑ 4.8 10 1

Bitmap Index Scan on fki_discipline_projects (cost=0.00..26.06 rows=48 width=0) (actual time=0.033..0.033 rows=10 loops=1)

  • Index Cond: (project_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[]))
72. 0.026 0.026 ↓ 1.7 10 1

Bitmap Index Scan on pk_disciplines (cost=0.00..25.74 rows=6 width=0) (actual time=0.026..0.026 rows=10 loops=1)

  • Index Cond: (discipline_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[]))
73.          

CTE cpudata

74. 0.001 0.023 ↓ 0.0 0 1

Merge Join (cost=148.57..148.73 rows=1 width=48) (actual time=0.023..0.023 rows=0 loops=1)

  • Merge Cond: (ci_10.user_id = dc.user_id)
75. 0.009 0.009 ↑ 12,635.0 1 1

Index Scan using fki_contract_items_users on contract_items ci_10 (cost=0.29..629.81 rows=12,635 width=32) (actual time=0.009..0.009 rows=1 loops=1)

76. 0.004 0.013 ↓ 0.0 0 1

Sort (cost=148.26..148.29 rows=14 width=32) (actual time=0.013..0.013 rows=0 loops=1)

  • Sort Key: dc.user_id
  • Sort Method: quicksort Memory: 25kB
77. 0.002 0.009 ↓ 0.0 0 1

Hash Join (cost=0.36..147.99 rows=14 width=32) (actual time=0.009..0.009 rows=0 loops=1)

  • Hash Cond: (dc.discipline_id = ddata.discipline_id)
78. 0.006 0.006 ↑ 5,054.0 1 1

Seq Scan on disciplines_contractors dc (cost=0.00..128.54 rows=5,054 width=32) (actual time=0.006..0.006 rows=1 loops=1)

79. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=0.22..0.22 rows=11 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
80. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on ddata (cost=0.00..0.22 rows=11 width=16) (actual time=0.000..0.000 rows=0 loops=1)

81.          

CTE tpdata

82. 0.001 0.034 ↓ 0.0 0 1

Nested Loop Left Join (cost=148.45..361.10 rows=20 width=64) (actual time=0.034..0.034 rows=0 loops=1)

83. 0.004 0.033 ↓ 0.0 0 1

Hash Join (cost=148.16..351.18 rows=20 width=48) (actual time=0.033..0.033 rows=0 loops=1)

  • Hash Cond: (dcc.disciplines_contractors_id = disciplines_contractors.disciplines_contractors_id)
84. 0.018 0.018 ↑ 7,114.0 1 1

Seq Scan on disciplines_contractors_crews dcc (cost=0.00..176.14 rows=7,114 width=48) (actual time=0.018..0.018 rows=1 loops=1)

85. 0.000 0.011 ↓ 0.0 0 1

Hash (cost=147.99..147.99 rows=14 width=16) (actual time=0.011..0.011 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
86. 0.003 0.011 ↓ 0.0 0 1

Hash Join (cost=0.36..147.99 rows=14 width=16) (actual time=0.011..0.011 rows=0 loops=1)

  • Hash Cond: (disciplines_contractors.discipline_id = ddata_1.discipline_id)
87. 0.007 0.007 ↑ 5,054.0 1 1

Seq Scan on disciplines_contractors (cost=0.00..128.54 rows=5,054 width=32) (actual time=0.007..0.007 rows=1 loops=1)

88. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=0.22..0.22 rows=11 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
89. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on ddata ddata_1 (cost=0.00..0.22 rows=11 width=16) (actual time=0.000..0.000 rows=0 loops=1)

90. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_crews on contract_items ci_11 (cost=0.29..0.49 rows=1 width=32) (never executed)

  • Index Cond: (dcc.crew_id = crew_id)
91.          

CTE tpudata

92. 0.001 0.001 ↓ 0.0 0 1

Nested Loop (cost=0.29..150.65 rows=2 width=32) (actual time=0.001..0.001 rows=0 loops=1)

93. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on tpdata (cost=0.00..0.40 rows=20 width=16) (actual time=0.000..0.000 rows=0 loops=1)

94. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_users on contract_items ci_12 (cost=0.29..7.50 rows=1 width=32) (never executed)

  • Index Cond: (user_id = tpdata.user_id)
95.          

CTE trpdata

96. 0.001 0.009 ↓ 0.0 0 1

Nested Loop (cost=0.94..909.53 rows=676 width=64) (actual time=0.009..0.009 rows=0 loops=1)

97. 0.001 0.008 ↓ 0.0 0 1

Hash Join (cost=0.65..514.29 rows=1,032 width=32) (actual time=0.008..0.008 rows=0 loops=1)

  • Hash Cond: (cdr_2.crew_id = tpdata_1.crew_id)
98. 0.006 0.006 ↑ 19,296.0 1 1

Seq Scan on crews_discipline_rates cdr_2 (cost=0.00..430.96 rows=19,296 width=32) (actual time=0.006..0.006 rows=1 loops=1)

99. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=0.40..0.40 rows=20 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
100. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on tpdata tpdata_1 (cost=0.00..0.40 rows=20 width=16) (actual time=0.000..0.000 rows=0 loops=1)

101. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_crews_discipline_rates on contract_items ci_13 (cost=0.29..0.37 rows=1 width=32) (never executed)

  • Index Cond: (crews_discipline_rates_id = cdr_2.crews_discipline_rates_id)
102.          

CTE toodata

103. 0.001 0.035 ↓ 0.0 0 1

Merge Join (cost=4.05..4.80 rows=144 width=32) (actual time=0.035..0.035 rows=0 loops=1)

  • Merge Cond: (ci_14.tools_id = t_2.tools_id)
104. 0.008 0.008 ↑ 12,635.0 1 1

Index Scan using fki_contract_items_tools on contract_items ci_14 (cost=0.29..1,493.10 rows=12,635 width=32) (actual time=0.008..0.008 rows=1 loops=1)

105. 0.003 0.026 ↓ 0.0 0 1

Sort (cost=3.77..3.77 rows=1 width=16) (actual time=0.026..0.026 rows=0 loops=1)

  • Sort Key: t_2.tools_id
  • Sort Method: quicksort Memory: 25kB
106. 0.023 0.023 ↓ 0.0 0 1

Seq Scan on tools t_2 (cost=0.00..3.76 rows=1 width=16) (actual time=0.023..0.023 rows=0 loops=1)

  • Filter: ((organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid) AND (tools_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[])))
  • Rows Removed by Filter: 88
107.          

CTE modata

108. 0.001 0.052 ↓ 0.0 0 1

Nested Loop (cost=0.00..589.01 rows=26 width=32) (actual time=0.052..0.052 rows=0 loops=1)

  • Join Filter: (m.modules_id = ci_15.modules_id)
109. 0.051 0.051 ↓ 0.0 0 1

Seq Scan on modules m (cost=0.00..15.72 rows=1 width=16) (actual time=0.051..0.051 rows=0 loops=1)

  • Filter: ((organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid) AND (modules_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[])))
  • Rows Removed by Filter: 486
110. 0.000 0.000 ↓ 0.0 0

Seq Scan on contract_items ci_15 (cost=0.00..415.35 rows=12,635 width=32) (never executed)

111.          

CTE wdata

112. 0.000 0.007 ↓ 0.0 0 1

Nested Loop (cost=0.29..9.59 rows=902 width=32) (actual time=0.007..0.007 rows=0 loops=1)

113. 0.007 0.007 ↓ 0.0 0 1

Seq Scan on warehouses w (cost=0.00..1.28 rows=1 width=16) (actual time=0.007..0.007 rows=0 loops=1)

  • Filter: ((organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid) AND (warehouse_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[])))
  • Rows Removed by Filter: 14
114. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_warehouses on contract_items ci_16 (cost=0.29..8.30 rows=1 width=32) (never executed)

  • Index Cond: (warehouse_id = w.warehouse_id)
115.          

CTE udata

116. 0.002 10.499 ↓ 0.0 0 1

Merge Join (cost=8.97..14.28 rows=9 width=32) (actual time=10.499..10.499 rows=0 loops=1)

  • Merge Cond: (ci_17.user_id = u.user_id)
117. 8.785 10.497 ↑ 299.0 1 1

Nested Loop (cost=0.29..1,582.09 rows=299 width=32) (actual time=10.497..10.497 rows=1 loops=1)

  • Join Filter: (ci_17.contract_id = c_5.contract_id)
  • Rows Removed by Join Filter: 51175
118. 1.712 1.712 ↑ 1.2 10,236 1

Index Scan using fki_contract_items_users on contract_items ci_17 (cost=0.29..629.81 rows=12,635 width=48) (actual time=0.006..1.712 rows=10,236 loops=1)

119. 0.000 0.000 ↑ 1.0 5 10,236

Materialize (cost=0.00..7.66 rows=5 width=16) (actual time=0.000..0.000 rows=5 loops=10,236)

120. 0.025 0.025 ↑ 1.0 5 1

Seq Scan on contracts c_5 (cost=0.00..7.64 rows=5 width=16) (actual time=0.022..0.025 rows=5 loops=1)

  • Filter: (organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid)
  • Rows Removed by Filter: 207
121. 0.000 0.000 ↓ 0.0 0

Sort (cost=8.67..8.68 rows=6 width=16) (never executed)

  • Sort Key: u.user_id
122. 0.000 0.000 ↓ 0.0 0

Seq Scan on users u (cost=0.00..8.59 rows=6 width=16) (never executed)

  • Filter: (user_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[]))
123.          

CTE ucdata

124. 0.001 0.021 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.58..12.71 rows=147 width=48) (actual time=0.021..0.021 rows=0 loops=1)

125. 0.004 0.020 ↓ 0.0 0 1

Hash Join (cost=0.29..4.40 rows=1 width=32) (actual time=0.020..0.020 rows=0 loops=1)

  • Hash Cond: (c_6.user_id = udata.user_id)
126. 0.015 0.015 ↑ 5.0 1 1

Seq Scan on contractors c_6 (cost=0.00..4.08 rows=5 width=32) (actual time=0.015..0.015 rows=1 loops=1)

  • Filter: (organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid)
  • Rows Removed by Filter: 54
127. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=0.18..0.18 rows=9 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
128. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on udata (cost=0.00..0.18 rows=9 width=16) (actual time=0.000..0.000 rows=0 loops=1)

129. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_contractors on contract_items ci_18 (cost=0.29..8.30 rows=1 width=32) (never executed)

  • Index Cond: (c_6.contractor_id = contractor_id)
130.          

CTE uctdata

131. 0.002 0.012 ↓ 0.0 0 1

Hash Right Join (cost=25.63..488.37 rows=12,635 width=48) (actual time=0.012..0.012 rows=0 loops=1)

  • Hash Cond: (ci_19.crew_id = t_3.crew_id)
132. 0.000 0.000 ↓ 0.0 0

Seq Scan on contract_items ci_19 (cost=0.00..415.35 rows=12,635 width=32) (never executed)

133. 0.001 0.010 ↓ 0.0 0 1

Hash (cost=20.85..20.85 rows=382 width=32) (actual time=0.010..0.010 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
134. 0.001 0.009 ↓ 0.0 0 1

Hash Join (cost=4.78..20.85 rows=382 width=32) (actual time=0.009..0.009 rows=0 loops=1)

  • Hash Cond: (t_3.contractor_id = ucdata.contractor_id)
135. 0.007 0.007 ↑ 382.0 1 1

Seq Scan on crews t_3 (cost=0.00..10.82 rows=382 width=32) (actual time=0.007..0.007 rows=1 loops=1)

136. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=2.94..2.94 rows=147 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
137. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on ucdata (cost=0.00..2.94 rows=147 width=16) (actual time=0.000..0.000 rows=0 loops=1)

138.          

CTE uctrdata

139. 0.003 10.335 ↓ 0.0 0 1

Merge Join (cost=3,175.67..9,641.66 rows=426,854 width=48) (actual time=10.335..10.335 rows=0 loops=1)

  • Merge Cond: (cdr_3.crew_id = uctdata.crew_id)
140. 2.633 10.322 ↑ 12,635.0 1 1

Sort (cost=2,062.21..2,093.79 rows=12,635 width=48) (actual time=10.322..10.322 rows=1 loops=1)

  • Sort Key: cdr_3.crew_id
  • Sort Method: quicksort Memory: 1360kB
141. 2.828 7.689 ↑ 1.0 12,483 1

Hash Join (cost=573.29..1,201.44 rows=12,635 width=48) (actual time=3.650..7.689 rows=12,483 loops=1)

  • Hash Cond: (cdr_3.crews_discipline_rates_id = ci_20.crews_discipline_rates_id)
142. 1.257 1.257 ↑ 1.0 19,296 1

Seq Scan on crews_discipline_rates cdr_3 (cost=0.00..430.96 rows=19,296 width=32) (actual time=0.007..1.257 rows=19,296 loops=1)

143. 1.431 3.604 ↑ 1.0 12,483 1

Hash (cost=415.35..415.35 rows=12,635 width=32) (actual time=3.604..3.604 rows=12,483 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 909kB
144. 2.173 2.173 ↓ 1.0 12,637 1

Seq Scan on contract_items ci_20 (cost=0.00..415.35 rows=12,635 width=32) (actual time=0.005..2.173 rows=12,637 loops=1)

145. 0.009 0.010 ↓ 0.0 0 1

Sort (cost=1,113.47..1,145.06 rows=12,635 width=16) (actual time=0.010..0.010 rows=0 loops=1)

  • Sort Key: uctdata.crew_id
  • Sort Method: quicksort Memory: 25kB
146. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on uctdata (cost=0.00..252.70 rows=12,635 width=16) (actual time=0.001..0.001 rows=0 loops=1)

147.          

CTE utdata

148. 0.001 0.021 ↓ 0.0 0 1

Hash Join (cost=8.28..133.34 rows=25 width=48) (actual time=0.021..0.021 rows=0 loops=1)

  • Hash Cond: (ci_21.contract_id = c_7.contract_id)
149. 0.000 0.020 ↓ 0.0 0 1

Nested Loop (cost=0.58..112.33 rows=1,058 width=64) (actual time=0.020..0.020 rows=0 loops=1)

150. 0.005 0.020 ↓ 0.0 0 1

Hash Join (cost=0.29..12.87 rows=32 width=32) (actual time=0.020..0.020 rows=0 loops=1)

  • Hash Cond: (t_4.user_id = udata_1.user_id)
151. 0.014 0.014 ↑ 382.0 1 1

Seq Scan on crews t_4 (cost=0.00..10.82 rows=382 width=32) (actual time=0.014..0.014 rows=1 loops=1)

152. 0.000 0.001 ↓ 0.0 0 1

Hash (cost=0.18..0.18 rows=9 width=16) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
153. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on udata udata_1 (cost=0.00..0.18 rows=9 width=16) (actual time=0.001..0.001 rows=0 loops=1)

154. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_crews on contract_items ci_21 (cost=0.29..3.10 rows=1 width=48) (never executed)

  • Index Cond: (crew_id = t_4.crew_id)
155. 0.000 0.000 ↓ 0.0 0

Hash (cost=7.64..7.64 rows=5 width=16) (never executed)

156. 0.000 0.000 ↓ 0.0 0

Seq Scan on contracts c_7 (cost=0.00..7.64 rows=5 width=16) (never executed)

  • Filter: (organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid)
157.          

CTE utrdata

158. 0.001 0.010 ↓ 0.0 0 1

Nested Loop (cost=1.10..1,011.08 rows=845 width=64) (actual time=0.010..0.010 rows=0 loops=1)

159. 0.002 0.009 ↓ 0.0 0 1

Hash Join (cost=0.81..517.03 rows=1,290 width=48) (actual time=0.009..0.009 rows=0 loops=1)

  • Hash Cond: (cdr_4.crew_id = utdata.crew_id)
160. 0.006 0.006 ↑ 19,296.0 1 1

Seq Scan on crews_discipline_rates cdr_4 (cost=0.00..430.96 rows=19,296 width=32) (actual time=0.006..0.006 rows=1 loops=1)

161. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=0.50..0.50 rows=25 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
162. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on utdata (cost=0.00..0.50 rows=25 width=32) (actual time=0.000..0.000 rows=0 loops=1)

163. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_crews_discipline_rates on contract_items ci_22 (cost=0.29..0.37 rows=1 width=32) (never executed)

  • Index Cond: (crews_discipline_rates_id = cdr_4.crews_discipline_rates_id)
164.          

CTE rdata

165. 0.000 0.028 ↓ 0.0 0 1

Nested Loop (cost=26.20..97.57 rows=1 width=48) (actual time=0.028..0.028 rows=0 loops=1)

166. 0.000 0.028 ↓ 0.0 0 1

Nested Loop (cost=26.06..96.89 rows=4 width=64) (actual time=0.028..0.028 rows=0 loops=1)

167. 0.001 0.028 ↓ 0.0 0 1

Bitmap Heap Scan on crews_discipline_rates cdr_5 (cost=25.77..47.02 rows=6 width=32) (actual time=0.028..0.028 rows=0 loops=1)

  • Recheck Cond: (crews_discipline_rates_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[]))
168. 0.027 0.027 ↓ 0.0 0 1

Bitmap Index Scan on pk_crews_discipline_rates (cost=0.00..25.77 rows=6 width=0) (actual time=0.027..0.027 rows=0 loops=1)

  • Index Cond: (crews_discipline_rates_id = ANY ('{a43f99c3-5e82-42af-b483-89a2f9eb5fb9,70d78930-a9a8-4f02-95f9-e39dd060378d,3a364f8d-69c4-4e95-94ee-c1d7bc9f34f4,5b1b9b96-c8b4-4ea2-a122-ed396814ad26,98826fcf-2089-40a3-a46d-49e66ee21d94,f81703b7-b526-4a6c-8105-d7c8967d4d0f}'::uuid[]))
169. 0.000 0.000 ↓ 0.0 0

Index Scan using fki_contract_items_crews_discipline_rates on contract_items ci_23 (cost=0.29..8.30 rows=1 width=48) (never executed)

  • Index Cond: (crews_discipline_rates_id = cdr_5.crews_discipline_rates_id)
170. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contract on contracts c_8 (cost=0.14..0.17 rows=1 width=16) (never executed)

  • Index Cond: (contract_id = ci_23.contract_id)
  • Filter: (organization_id = '9c2878ea-9c99-45dc-899c-764585fde3d2'::uuid)
171.          

CTE alldata

172. 0.001 34.300 ↑ 883,103.0 1 1

Unique (cost=128,804.82..133,220.34 rows=883,103 width=16) (actual time=34.300..34.300 rows=1 loops=1)

173. 0.015 34.299 ↑ 883,103.0 1 1

Sort (cost=128,804.82..131,012.58 rows=883,103 width=16) (actual time=34.299..34.299 rows=1 loops=1)

  • Sort Key: cdata_2.cid
  • Sort Method: quicksort Memory: 25kB
174. 0.012 34.284 ↑ 883,103.0 1 1

Append (cost=0.00..26,493.09 rows=883,103 width=16) (actual time=11.586..34.284 rows=1 loops=1)

175. 0.018 0.018 ↓ 0.0 0 1

CTE Scan on cdata cdata_2 (cost=0.00..2.94 rows=147 width=16) (actual time=0.018..0.018 rows=0 loops=1)

176. 0.100 0.100 ↓ 0.0 0 1

CTE Scan on tdata tdata_2 (cost=0.00..0.66 rows=33 width=16) (actual time=0.100..0.100 rows=0 loops=1)

177. 0.033 0.033 ↓ 0.0 0 1

CTE Scan on trdata (cost=0.00..22.30 rows=1,115 width=16) (actual time=0.033..0.033 rows=0 loops=1)

178. 0.018 0.018 ↓ 0.0 0 1

CTE Scan on tcdata tcdata_2 (cost=0.00..252.70 rows=12,635 width=16) (actual time=0.018..0.018 rows=0 loops=1)

179. 11.353 11.353 ↓ 0.0 0 1

CTE Scan on tcrdata (cost=0.00..8,537.08 rows=426,854 width=16) (actual time=11.353..11.353 rows=0 loops=1)

180. 0.061 0.061 ↑ 16.0 1 1

CTE Scan on pdata (cost=0.00..0.32 rows=16 width=16) (actual time=0.061..0.061 rows=1 loops=1)

181. 0.146 0.146 ↓ 0.0 0 1

CTE Scan on ddata ddata_2 (cost=0.00..0.22 rows=11 width=16) (actual time=0.146..0.146 rows=0 loops=1)

182. 0.035 0.035 ↓ 0.0 0 1

CTE Scan on tpdata tpdata_2 (cost=0.00..0.40 rows=20 width=16) (actual time=0.035..0.035 rows=0 loops=1)

183. 0.009 0.009 ↓ 0.0 0 1

CTE Scan on trpdata (cost=0.00..13.52 rows=676 width=16) (actual time=0.009..0.009 rows=0 loops=1)

184. 0.036 0.036 ↓ 0.0 0 1

CTE Scan on toodata (cost=0.00..2.88 rows=144 width=16) (actual time=0.036..0.036 rows=0 loops=1)

185. 0.052 0.052 ↓ 0.0 0 1

CTE Scan on modata (cost=0.00..0.52 rows=26 width=16) (actual time=0.052..0.052 rows=0 loops=1)

186. 0.008 0.008 ↓ 0.0 0 1

CTE Scan on wdata (cost=0.00..18.04 rows=902 width=16) (actual time=0.008..0.008 rows=0 loops=1)

187. 10.500 10.500 ↓ 0.0 0 1

CTE Scan on udata udata_2 (cost=0.00..0.18 rows=9 width=16) (actual time=10.500..10.500 rows=0 loops=1)

188. 0.026 0.026 ↓ 0.0 0 1

CTE Scan on cudata (cost=0.00..0.02 rows=1 width=16) (actual time=0.026..0.026 rows=0 loops=1)

189. 1.423 1.423 ↓ 0.0 0 1

CTE Scan on tcudata (cost=0.00..0.06 rows=3 width=16) (actual time=1.423..1.423 rows=0 loops=1)

190. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on tudata (cost=0.00..0.02 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=1)

191. 0.021 0.021 ↓ 0.0 0 1

CTE Scan on ucdata ucdata_1 (cost=0.00..2.94 rows=147 width=16) (actual time=0.021..0.021 rows=0 loops=1)

192. 0.012 0.012 ↓ 0.0 0 1

CTE Scan on uctdata uctdata_1 (cost=0.00..252.70 rows=12,635 width=16) (actual time=0.012..0.012 rows=0 loops=1)

193. 10.335 10.335 ↓ 0.0 0 1

CTE Scan on uctrdata (cost=0.00..8,537.08 rows=426,854 width=16) (actual time=10.335..10.335 rows=0 loops=1)

194. 0.021 0.021 ↓ 0.0 0 1

CTE Scan on utdata utdata_1 (cost=0.00..0.50 rows=25 width=16) (actual time=0.021..0.021 rows=0 loops=1)

195. 0.010 0.010 ↓ 0.0 0 1

CTE Scan on utrdata (cost=0.00..16.90 rows=845 width=16) (actual time=0.010..0.010 rows=0 loops=1)

196. 0.024 0.024 ↓ 0.0 0 1

CTE Scan on cpudata (cost=0.00..0.02 rows=1 width=16) (actual time=0.024..0.024 rows=0 loops=1)

197. 0.001 0.001 ↓ 0.0 0 1

CTE Scan on tpudata (cost=0.00..0.04 rows=2 width=16) (actual time=0.001..0.001 rows=0 loops=1)

198. 0.029 0.029 ↓ 0.0 0 1

CTE Scan on rdata (cost=0.00..0.02 rows=1 width=16) (actual time=0.029..0.029 rows=0 loops=1)

Planning time : 21.121 ms