explain.depesz.com

PostgreSQL's explain analyze made readable

Result: LDkb

Settings
# exclusive inclusive rows x rows loops node
1. 592.493 37,361.136 ↓ 2.7 1,583,781 1

Hash Left Join (cost=2,411,727.14..2,455,317.62 rows=590,704 width=108) (actual time=35,785.313..37,361.136 rows=1,583,781 loops=1)

  • Hash Cond: (projects.account_id = accounts_1.id)
  • Filter: ((((""*SELECT* 1"".vacation_user_id)::double precision) IS NULL) OR (((""*SELECT* 1"".vacation_hours)::double precision) < (COALESCE(staff_membership_activity_links.capacity, accounts_1.default_capacity))::double precision))
  • Rows Removed by Filter: 13,596
2. 613.916 36,768.466 ↑ 1.1 1,597,377 1

Merge Left Join (cost=2,411,708.17..2,428,461.60 rows=1,754,565 width=144) (actual time=35,785.122..36,768.466 rows=1,597,377 loops=1)

  • Merge Cond: ((projects.account_id = staff_memberships_1.account_id) AND ("*SELECT* 1".user_id = staff_memberships_1.user_id))
  • Join Filter: ((""*SELECT* 1"".date >= (COALESCE(staff_membership_activity_links.start_date, staff_memberships_1.joined_at))) AND (""*SELECT* 1"".date <= (COALESCE(lag((staff_membership_activity_links.start_date - 1), 1) OVER (?), staff_memberships_1.archived_at, '3000-01-01'::date))))
  • Rows Removed by Join Filter: 258,899
3. 1,979.818 36,058.429 ↑ 1.1 1,597,377 1

Sort (cost=2,410,861.03..2,415,247.45 rows=1,754,565 width=120) (actual time=35,769.285..36,058.429 rows=1,597,377 loops=1)

  • Sort Key: projects.account_id, ""*SELECT* 1"".user_id
  • Sort Method: external merge Disk: 135,008kB
4. 392.210 34,078.611 ↑ 1.1 1,597,377 1

Hash Left Join (cost=1,704,106.50..2,120,942.11 rows=1,754,565 width=120) (actual time=2,184.329..34,078.611 rows=1,597,377 loops=1)

  • Hash Cond: ("*SELECT* 1".project_id = projects.id)
5. 187.596 33,684.629 ↑ 1.1 1,597,377 1

Append (cost=1,703,877.73..2,098,558.60 rows=1,754,565 width=116) (actual time=2,182.502..33,684.629 rows=1,597,377 loops=1)

6. 281.827 20,896.704 ↑ 1.2 893,416 1

Result (cost=1,703,877.73..1,899,085.58 rows=1,050,604 width=116) (actual time=2,182.502..20,896.704 rows=893,416 loops=1)

7. 99.179 20,614.877 ↑ 1.2 893,416 1

Append (cost=1,703,877.73..1,885,953.03 rows=1,050,604 width=140) (actual time=2,182.497..20,614.877 rows=893,416 loops=1)

8. 107.783 2,871.093 ↑ 1.5 661,732 1

Subquery Scan on *SELECT* 1 (cost=1,703,877.73..1,747,211.14 rows=968,516 width=114) (actual time=2,182.496..2,871.093 rows=661,732 loops=1)

9. 158.505 2,763.310 ↑ 1.5 661,732 1

Merge Left Join (cost=1,703,877.73..1,732,683.40 rows=968,516 width=134) (actual time=2,182.495..2,763.310 rows=661,732 loops=1)

  • Merge Cond: ((generate_series.generate_series = summary_vacations_by_dates.date) AND (projects_1.account_id = summary_vacations_by_dates.account_id) AND (plan_rows.user_id = summary_vacations_by_dates.user_id))
10. 188.469 2,490.112 ↑ 1.5 661,732 1

Merge Anti Join (cost=1,097,280.45..1,110,589.83 rows=968,516 width=66) (actual time=2,182.491..2,490.112 rows=661,732 loops=1)

  • Merge Cond: ((generate_series.generate_series = non_working_intervals_by_dates.date) AND (projects_1.account_id = non_working_intervals_by_dates.account_id) AND (plan_rows.user_id = non_working_intervals_by_dates.user_id))
11. 1,159.213 2,260.892 ↑ 1.8 669,378 1

Sort (cost=1,091,262.46..1,094,329.46 rows=1,226,800 width=66) (actual time=2,182.487..2,260.892 rows=669,378 loops=1)

  • Sort Key: generate_series.generate_series, projects_1.account_id, plan_rows.user_id
  • Sort Method: quicksort Memory: 118,708kB
12. 243.794 1,101.679 ↑ 1.8 669,378 1

Merge Left Join (cost=20,251.69..967,193.30 rows=1,226,800 width=66) (actual time=268.262..1,101.679 rows=669,378 loops=1)

  • Merge Cond: (plan_items.plan_row_uuid = pa.plan_row_uuid)
  • Join Filter: (((pa.epic_id = plan_rows.epic_id) OR (plan_rows.epic_id IS NULL)) AND (pa.project_plan_id = project_plans.id) AND (pa.user_id = plan_rows.user_id) AND ((generate_series.generate_series)::date >= pa.start_date) AND ((generate_series.generate_series)::date <= pa.end_date))
  • Rows Removed by Join Filter: 328,283
13. 107.735 622.458 ↑ 1.8 669,378 1

Nested Loop (cost=10,797.17..944,143.86 rows=1,226,800 width=70) (actual time=93.116..622.458 rows=669,378 loops=1)

14. 23.595 132.419 ↑ 1.0 47,788 1

Merge Join (cost=10,797.16..11,775.85 rows=49,072 width=70) (actual time=93.100..132.419 rows=47,788 loops=1)

  • Merge Cond: (plan_rows.uuid = plan_items.plan_row_uuid)
15. 22.666 31.285 ↑ 1.0 42,344 1

Sort (cost=4,291.23..4,397.30 rows=42,428 width=28) (actual time=24.424..31.285 rows=42,344 loops=1)

  • Sort Key: plan_rows.uuid
  • Sort Method: quicksort Memory: 4,845kB
16. 8.619 8.619 ↑ 1.0 42,344 1

Seq Scan on plan_rows (cost=0.00..1,030.06 rows=42,428 width=28) (actual time=0.016..8.619 rows=42,344 loops=1)

  • Filter: (user_id IS NOT NULL)
  • Rows Removed by Filter: 5,762
17. 36.797 77.539 ↓ 1.0 55,664 1

Sort (cost=6,504.63..6,643.72 rows=55,639 width=58) (actual time=68.669..77.539 rows=55,664 loops=1)

  • Sort Key: plan_items.plan_row_uuid
  • Sort Method: quicksort Memory: 9,364kB
18. 11.817 40.742 ↓ 1.0 55,664 1

Hash Left Join (cost=430.80..2,119.21 rows=55,639 width=58) (actual time=3.612..40.742 rows=55,664 loops=1)

  • Hash Cond: (project_plans.project_id = projects_1.id)
19. 14.978 27.035 ↓ 1.0 55,664 1

Hash Left Join (cost=202.03..1,744.28 rows=55,639 width=54) (actual time=1.708..27.035 rows=55,664 loops=1)

  • Hash Cond: (plan_items.project_plan_id = project_plans.id)
20. 10.410 10.410 ↓ 1.0 55,664 1

Seq Scan on plan_items (cost=0.00..1,396.10 rows=55,639 width=46) (actual time=0.017..10.410 rows=55,664 loops=1)

  • Filter: (utilization > '0'::numeric)
  • Rows Removed by Filter: 264
21. 0.483 1.647 ↑ 1.0 2,851 1

Hash (cost=166.39..166.39 rows=2,851 width=8) (actual time=1.647..1.647 rows=2,851 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 144kB
22. 1.164 1.164 ↑ 1.0 2,851 1

Seq Scan on project_plans (cost=0.00..166.39 rows=2,851 width=8) (actual time=0.006..1.164 rows=2,851 loops=1)

  • Filter: active
  • Rows Removed by Filter: 3,188
23. 0.964 1.890 ↑ 1.0 5,812 1

Hash (cost=156.12..156.12 rows=5,812 width=8) (actual time=1.890..1.890 rows=5,812 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 292kB
24. 0.926 0.926 ↑ 1.0 5,812 1

Seq Scan on projects projects_1 (cost=0.00..156.12 rows=5,812 width=8) (actual time=0.008..0.926 rows=5,812 loops=1)

25. 382.304 382.304 ↑ 1.8 14 47,788

Function Scan on generate_series (cost=0.01..18.76 rows=25 width=8) (actual time=0.003..0.008 rows=14 loops=47,788)

  • Filter: (date_part('dow'::text, generate_series) = ANY ('{1,2,3,4,5}'::double precision[]))
  • Rows Removed by Filter: 5
26. 77.139 235.427 ↓ 141.0 700,994 1

Sort (cost=9,454.52..9,466.95 rows=4,971 width=36) (actual time=175.139..235.427 rows=700,994 loops=1)

  • Sort Key: pa.plan_row_uuid
  • Sort Method: quicksort Memory: 5,007kB
27. 5.768 158.288 ↓ 8.9 44,428 1

Subquery Scan on pa (cost=9,025.04..9,149.32 rows=4,971 width=36) (actual time=115.714..158.288 rows=44,428 loops=1)

28. 64.051 152.520 ↓ 8.9 44,428 1

HashAggregate (cost=9,025.04..9,099.61 rows=4,971 width=48) (actual time=115.713..152.520 rows=44,428 loops=1)

  • Group Key: plan_rows_1.project_plan_id, plan_rows_1.epic_id, plan_rows_1.user_id, plan_roles.activity_id, COALESCE(plan_roles.start_date, '1980-01-01'::date), COALESCE(lag((plan_roles.start_date - 1), 1) OVER (?), '3000-01-01'::date)
29. 28.001 88.469 ↑ 1.0 44,581 1

WindowAgg (cost=6,572.98..7,576.09 rows=44,583 width=68) (actual time=55.232..88.469 rows=44,581 loops=1)

30. 23.297 60.468 ↑ 1.0 44,581 1

Sort (cost=6,572.98..6,684.43 rows=44,583 width=52) (actual time=55.223..60.468 rows=44,581 loops=1)

  • Sort Key: plan_roles.plan_row_uuid, plan_roles.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 5,023kB
31. 15.351 37.171 ↑ 1.0 44,581 1

Hash Join (cost=1,631.38..3,130.23 rows=44,583 width=52) (actual time=17.827..37.171 rows=44,581 loops=1)

  • Hash Cond: (plan_roles.plan_row_uuid = plan_rows_1.uuid)
32. 4.035 4.035 ↑ 1.0 44,583 1

Seq Scan on plan_roles (cost=0.00..885.83 rows=44,583 width=24) (actual time=0.014..4.035 rows=44,583 loops=1)

33. 9.832 17.785 ↑ 1.0 48,106 1

Hash (cost=1,030.06..1,030.06 rows=48,106 width=28) (actual time=17.785..17.785 rows=48,106 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 3,180kB
34. 7.953 7.953 ↑ 1.0 48,106 1

Seq Scan on plan_rows plan_rows_1 (cost=0.00..1,030.06 rows=48,106 width=28) (actual time=0.006..7.953 rows=48,106 loops=1)

35. 30.954 40.751 ↑ 1.0 59,712 1

Sort (cost=6,017.99..6,167.27 rows=59,712 width=12) (actual time=36.336..40.751 rows=59,712 loops=1)

  • Sort Key: non_working_intervals_by_dates.date, non_working_intervals_by_dates.account_id, non_working_intervals_by_dates.user_id
  • Sort Method: quicksort Memory: 4,336kB
36. 9.797 9.797 ↑ 1.0 59,712 1

Seq Scan on non_working_intervals_by_dates (cost=0.00..1,281.12 rows=59,712 width=12) (actual time=0.006..9.797 rows=59,712 loops=1)

37. 30.715 114.693 ↑ 15.5 37,179 1

Sort (cost=606,597.28..608,034.78 rows=575,000 width=44) (actual time=109.030..114.693 rows=37,179 loops=1)

  • Sort Key: summary_vacations_by_dates.date, summary_vacations_by_dates.account_id, summary_vacations_by_dates.user_id
  • Sort Method: quicksort Memory: 2,844kB
38. 4.286 83.978 ↑ 17.8 32,266 1

Subquery Scan on summary_vacations_by_dates (cost=537,214.32..551,589.32 rows=575,000 width=44) (actual time=63.230..83.978 rows=32,266 loops=1)

39. 31.971 79.692 ↑ 17.8 32,266 1

HashAggregate (cost=537,214.32..545,839.32 rows=575,000 width=52) (actual time=63.229..79.692 rows=32,266 loops=1)

  • Group Key: generate_series_1.generate_series, staff_memberships.user_id, staff_memberships.account_id
40. 11.131 47.721 ↑ 134.2 32,422 1

Hash Join (cost=138.05..493,700.50 rows=4,351,382 width=21) (actual time=1.522..47.721 rows=32,422 loops=1)

  • Hash Cond: (vacations.staff_membership_id = staff_memberships.id)
  • Join Filter: ((generate_series_1.generate_series >= staff_memberships.joined_at) AND ((staff_memberships.archived_at IS NULL) OR (generate_series_1.generate_series <= staff_memberships.archived_at)))
  • Rows Removed by Join Filter: 1,908
41. 11.146 35.135 ↑ 634.8 34,330 1

Nested Loop (cost=0.01..436,340.93 rows=21,792,000 width=17) (actual time=0.023..35.135 rows=34,330 loops=1)

42. 2.197 2.197 ↑ 1.0 21,792 1

Seq Scan on vacations (cost=0.00..500.92 rows=21,792 width=17) (actual time=0.013..2.197 rows=21,792 loops=1)

43. 21.792 21.792 ↑ 500.0 2 21,792

Function Scan on generate_series generate_series_1 (cost=0.01..10.01 rows=1,000 width=8) (actual time=0.001..0.001 rows=2 loops=21,792)

44. 0.757 1.455 ↑ 1.0 4,002 1

Hash (cost=88.02..88.02 rows=4,002 width=20) (actual time=1.455..1.455 rows=4,002 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 229kB
45. 0.698 0.698 ↑ 1.0 4,002 1

Seq Scan on staff_memberships (cost=0.00..88.02 rows=4,002 width=20) (actual time=0.006..0.698 rows=4,002 loops=1)

46. 167.295 17,644.605 ↓ 2.8 231,684 1

Hash Left Join (cost=2,062.19..132,667.99 rows=82,088 width=114) (actual time=21.999..17,644.605 rows=231,684 loops=1)

  • Hash Cond: (project_plans_1.project_id = projects_1_1.id)
  • Filter: (NOT (SubPlan 1))
  • Rows Removed by Filter: 770
47. 49.069 273.642 ↓ 1.4 232,454 1

Nested Loop (cost=1,833.42..128,784.81 rows=164,175 width=58) (actual time=19.471..273.642 rows=232,454 loops=1)

48. 3.372 59.177 ↓ 1.2 7,876 1

Hash Left Join (cost=1,833.41..4,011.80 rows=6,567 width=58) (actual time=19.447..59.177 rows=7,876 loops=1)

  • Hash Cond: (plan_items_1.project_plan_id = project_plans_1.id)
49. 24.549 53.849 ↓ 1.2 7,876 1

Hash Left Join (cost=1,631.38..3,792.52 rows=6,567 width=54) (actual time=17.372..53.849 rows=7,876 loops=1)

  • Hash Cond: (plan_items_1.plan_row_uuid = plan_rows_2.uuid)
  • Filter: (plan_rows_2.user_id IS NULL)
  • Rows Removed by Filter: 47,788
50. 12.044 12.044 ↓ 1.0 55,664 1

Seq Scan on plan_items plan_items_1 (cost=0.00..1,396.10 rows=55,639 width=46) (actual time=0.014..12.044 rows=55,664 loops=1)

  • Filter: (utilization > '0'::numeric)
  • Rows Removed by Filter: 264
51. 9.581 17.256 ↑ 1.0 48,106 1

Hash (cost=1,030.06..1,030.06 rows=48,106 width=28) (actual time=17.256..17.256 rows=48,106 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 3,117kB
52. 7.675 7.675 ↑ 1.0 48,106 1

Seq Scan on plan_rows plan_rows_2 (cost=0.00..1,030.06 rows=48,106 width=28) (actual time=0.005..7.675 rows=48,106 loops=1)

53. 0.571 1.956 ↑ 1.0 2,851 1

Hash (cost=166.39..166.39 rows=2,851 width=8) (actual time=1.956..1.956 rows=2,851 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 144kB
54. 1.385 1.385 ↑ 1.0 2,851 1

Seq Scan on project_plans project_plans_1 (cost=0.00..166.39 rows=2,851 width=8) (actual time=0.014..1.385 rows=2,851 loops=1)

  • Filter: active
  • Rows Removed by Filter: 3,188
55. 165.396 165.396 ↓ 1.2 30 7,876

Function Scan on generate_series generate_series_2 (cost=0.01..18.76 rows=25 width=8) (actual time=0.007..0.021 rows=30 loops=7,876)

  • Filter: (date_part('dow'::text, generate_series) = ANY ('{1,2,3,4,5}'::double precision[]))
  • Rows Removed by Filter: 12
56. 0.962 2.072 ↑ 1.0 5,812 1

Hash (cost=156.12..156.12 rows=5,812 width=12) (actual time=2.072..2.072 rows=5,812 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 314kB
57. 1.110 1.110 ↑ 1.0 5,812 1

Seq Scan on projects projects_1_1 (cost=0.00..156.12 rows=5,812 width=12) (actual time=0.010..1.110 rows=5,812 loops=1)

58.          

SubPlan (for Hash Left Join)

59. 276.104 17,201.596 ↓ 0.0 0 232,454

Nested Loop (cost=63.65..107.78 rows=1 width=0) (actual time=0.074..0.074 rows=0 loops=232,454)

  • Join Filter: (non_working_intervals_by_dates_1.office_id = clients.office_id)
  • Rows Removed by Join Filter: 1
60. 232.454 232.454 ↓ 0.0 0 232,454

Bitmap Heap Scan on clients (cost=4.29..8.30 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=232,454)

  • Recheck Cond: (projects_1_1.client_id = id)
  • Heap Blocks: exact=58,986
61. 0.000 0.000 ↓ 0.0 0 232,454

Bitmap Index Scan on clients_pkey (cost=0.00..4.29 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=232,454)

  • Index Cond: (projects_1_1.client_id = id)
62. 58.986 16,693.038 ↑ 2.2 5 58,986

Bitmap Heap Scan on non_working_intervals_by_dates non_working_intervals_by_dates_1 (cost=59.37..99.35 rows=11 width=4) (actual time=0.283..0.283 rows=5 loops=58,986)

  • Recheck Cond: ((projects_1_1.account_id = account_id) AND (generate_series_2.generate_series = date))
  • Heap Blocks: exact=9,438
63. 16,634.052 16,634.052 ↑ 1.6 7 58,986

Bitmap Index Scan on non_working_intervals_by_dates_idx (cost=0.00..59.37 rows=11 width=0) (actual time=0.282..0.282 rows=7 loops=58,986)

  • Index Cond: ((projects_1_1.account_id = account_id) AND (generate_series_2.generate_series = date))
64. 11,879.295 12,600.329 ↑ 1.0 703,961 1

Hash Right Join (cost=45,525.20..183,660.58 rows=703,961 width=116) (actual time=660.769..12,600.329 rows=703,961 loops=1)

  • Hash Cond: (plan_rows_3.user_id = time_logs.user_id)
  • Join Filter: ((time_logs.date >= (COALESCE(plan_roles_1.start_date, '1980-01-01'::date))) AND (time_logs.date <= (COALESCE(lag((plan_roles_1.start_date - 1), 1) OVER (?), '3000-01-01'::date))) AND (((plan_rows_3.epic_id = time_logs.epic_id) AND (plan_rows_3.project_plan_id = epics.project_plan_id)) OR ((plan_rows_3.epic_id IS NULL) AND (plan_rows_3.project_plan_id = general_epic_plans.id))))
  • Rows Removed by Join Filter: 63,215,381
65. 93.030 182.538 ↓ 8.9 44,428 1

HashAggregate (cost=9,025.04..9,099.61 rows=4,971 width=48) (actual time=118.396..182.538 rows=44,428 loops=1)

  • Group Key: plan_rows_3.project_plan_id, plan_rows_3.epic_id, plan_rows_3.user_id, plan_roles_1.activity_id, COALESCE(plan_roles_1.start_date, '1980-01-01'::date), COALESCE(lag((plan_roles_1.start_date - 1), 1) OVER (?), '3000-01-01'::date)
66. 28.833 89.508 ↑ 1.0 44,581 1

WindowAgg (cost=6,572.98..7,576.09 rows=44,583 width=68) (actual time=55.085..89.508 rows=44,581 loops=1)

67. 23.904 60.675 ↑ 1.0 44,581 1

Sort (cost=6,572.98..6,684.43 rows=44,583 width=52) (actual time=55.074..60.675 rows=44,581 loops=1)

  • Sort Key: plan_roles_1.plan_row_uuid, plan_roles_1.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 5,023kB
68. 15.372 36.771 ↑ 1.0 44,581 1

Hash Join (cost=1,631.38..3,130.23 rows=44,583 width=52) (actual time=17.793..36.771 rows=44,581 loops=1)

  • Hash Cond: (plan_roles_1.plan_row_uuid = plan_rows_3.uuid)
69. 3.925 3.925 ↑ 1.0 44,583 1

Seq Scan on plan_roles plan_roles_1 (cost=0.00..885.83 rows=44,583 width=24) (actual time=0.011..3.925 rows=44,583 loops=1)

70. 9.605 17.474 ↑ 1.0 48,106 1

Hash (cost=1,030.06..1,030.06 rows=48,106 width=28) (actual time=17.474..17.474 rows=48,106 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 3,180kB
71. 7.869 7.869 ↑ 1.0 48,106 1

Seq Scan on plan_rows plan_rows_3 (cost=0.00..1,030.06 rows=48,106 width=28) (actual time=0.013..7.869 rows=48,106 loops=1)

72. 184.048 538.496 ↑ 1.0 703,961 1

Hash (cost=27,700.65..27,700.65 rows=703,961 width=40) (actual time=538.496..538.496 rows=703,961 loops=1)

  • Buckets: 1,048,576 Batches: 1 Memory Usage: 62,366kB
73. 232.082 354.448 ↑ 1.0 703,961 1

Hash Left Join (cost=1,826.58..27,700.65 rows=703,961 width=40) (actual time=16.698..354.448 rows=703,961 loops=1)

  • Hash Cond: (time_logs.epic_id = epics.id)
74. 106.638 106.638 ↑ 1.0 703,961 1

Seq Scan on time_logs (cost=0.00..16,194.61 rows=703,961 width=28) (actual time=0.920..106.638 rows=703,961 loops=1)

75. 4.833 15.728 ↑ 1.0 26,435 1

Hash (cost=1,496.14..1,496.14 rows=26,435 width=16) (actual time=15.728..15.728 rows=26,435 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,381kB
76. 6.809 10.895 ↑ 1.0 26,435 1

Hash Left Join (cost=202.03..1,496.14 rows=26,435 width=16) (actual time=1.655..10.895 rows=26,435 loops=1)

  • Hash Cond: (epics.project_id = general_epic_plans.project_id)
  • Join Filter: (epics.project_plan_id IS NULL)
  • Rows Removed by Join Filter: 11,144
77. 2.472 2.472 ↑ 1.0 26,435 1

Seq Scan on epics (cost=0.00..619.35 rows=26,435 width=12) (actual time=0.008..2.472 rows=26,435 loops=1)

78. 0.457 1.614 ↑ 1.0 2,851 1

Hash (cost=166.39..166.39 rows=2,851 width=8) (actual time=1.614..1.614 rows=2,851 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 144kB
79. 1.157 1.157 ↑ 1.0 2,851 1

Seq Scan on project_plans general_epic_plans (cost=0.00..166.39 rows=2,851 width=8) (actual time=0.011..1.157 rows=2,851 loops=1)

  • Filter: active
  • Rows Removed by Filter: 3,188
80. 0.899 1.772 ↑ 1.0 5,812 1

Hash (cost=156.12..156.12 rows=5,812 width=8) (actual time=1.772..1.772 rows=5,812 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 292kB
81. 0.873 0.873 ↑ 1.0 5,812 1

Seq Scan on projects (cost=0.00..156.12 rows=5,812 width=8) (actual time=0.012..0.873 rows=5,812 loops=1)

82. 78.616 96.121 ↓ 295.4 1,255,026 1

Materialize (cost=847.14..942.74 rows=4,249 width=40) (actual time=15.831..96.121 rows=1,255,026 loops=1)

83. 1.223 17.505 ↑ 1.0 4,218 1

Unique (cost=847.14..889.63 rows=4,249 width=65) (actual time=15.828..17.505 rows=4,218 loops=1)

84. 6.127 16.282 ↑ 1.0 4,246 1

Sort (cost=847.14..857.76 rows=4,249 width=65) (actual time=15.827..16.282 rows=4,246 loops=1)

  • Sort Key: staff_memberships_1.account_id, staff_memberships_1.user_id, (COALESCE(staff_membership_activity_links.start_date, staff_memberships_1.joined_at)), (COALESCE(lag((staff_membership_activity_links.start_date - 1), 1) OVER (?), staff_memberships_1.archived_at, '3000-01-01'::date)) DESC
  • Sort Method: quicksort Memory: 790kB
85. 3.245 10.155 ↑ 1.0 4,249 1

WindowAgg (cost=484.85..591.08 rows=4,249 width=65) (actual time=6.540..10.155 rows=4,249 loops=1)

86. 2.930 6.910 ↑ 1.0 4,249 1

Sort (cost=484.85..495.47 rows=4,249 width=56) (actual time=6.529..6.910 rows=4,249 loops=1)

  • Sort Key: staff_membership_activity_links.staff_membership_id, staff_membership_activity_links.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 790kB
87. 1.609 3.980 ↑ 1.0 4,249 1

Hash Join (cost=138.05..228.79 rows=4,249 width=56) (actual time=1.971..3.980 rows=4,249 loops=1)

  • Hash Cond: (staff_membership_activity_links.staff_membership_id = staff_memberships_1.id)
88. 0.454 0.454 ↑ 1.0 4,256 1

Seq Scan on staff_membership_activity_links (cost=0.00..79.56 rows=4,256 width=28) (actual time=0.012..0.454 rows=4,256 loops=1)

89. 1.057 1.917 ↑ 1.0 4,002 1

Hash (cost=88.02..88.02 rows=4,002 width=32) (actual time=1.917..1.917 rows=4,002 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 276kB
90. 0.860 0.860 ↑ 1.0 4,002 1

Seq Scan on staff_memberships staff_memberships_1 (cost=0.00..88.02 rows=4,002 width=32) (actual time=0.007..0.860 rows=4,002 loops=1)

91. 0.089 0.177 ↑ 1.0 354 1

Hash (cost=14.54..14.54 rows=354 width=9) (actual time=0.177..0.177 rows=354 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 24kB
92. 0.088 0.088 ↑ 1.0 354 1

Seq Scan on accounts accounts_1 (cost=0.00..14.54 rows=354 width=9) (actual time=0.014..0.088 rows=354 loops=1)

Planning time : 4.972 ms
Execution time : 37,528.104 ms