explain.depesz.com

PostgreSQL's explain analyze made readable

Result: v44s

Settings
# exclusive inclusive rows x rows loops node
1. 4.618 42,766.215 ↑ 1.0 1 1

Aggregate (cost=17,361,842.35..17,361,842.37 rows=1 width=32) (actual time=42,766.215..42,766.215 rows=1 loops=1)

2. 0.960 42,761.597 ↑ 126.7 854 1

Subquery Scan on t (cost=17,215,734.55..17,361,571.78 rows=108,228 width=80) (actual time=41,920.414..42,761.597 rows=854 loops=1)

3. 839.184 42,760.637 ↑ 126.7 854 1

GroupAggregate (cost=17,215,734.55..17,360,489.50 rows=108,228 width=109) (actual time=41,920.409..42,760.637 rows=854 loops=1)

  • Group Key: projects.id, ""*SELECT* 1_1"".project_plan_id, ""*SELECT* 1_1"".user_id, (COALESCE(""*SELECT* 1_1"".activity_id, sa.activity_id)), ""*SELECT* 1_1"".epic_id, ('PlanItem'::text), ""*SELECT* 1"".currency, ((""*SELECT* 1_1"".date < CURRENT_DATE)), (date_trunc('month'::text, (""*SELECT* 1_1"".date)::timestamp with time zone))
4. 25.546 41,921.453 ↑ 11.7 9,262 1

Sort (cost=17,215,734.55..17,216,005.12 rows=108,228 width=129) (actual time=41,919.166..41,921.453 rows=9,262 loops=1)

  • Sort Key: projects.id, ""*SELECT* 1_1"".project_plan_id, ""*SELECT* 1_1"".user_id, (COALESCE(""*SELECT* 1_1"".activity_id, sa.activity_id)), ""*SELECT* 1_1"".epic_id, ('PlanItem'::text), ""*SELECT* 1"".currency, ((""*SELECT* 1_1"".date < CURRENT_DATE)), (date_trunc('month'::text, (""*SELECT* 1_1"".date)::timestamp with time zone))
  • Sort Method: quicksort Memory: 1687kB
5. 9.749 41,895.907 ↑ 11.7 9,262 1

Hash Left Join (cost=1,091,496.49..17,206,684.68 rows=108,228 width=129) (actual time=5,095.002..41,895.907 rows=9,262 loops=1)

  • Hash Cond: ((projects.id = ""*SELECT* 1"".project_id) AND ((COALESCE(""*SELECT* 1_1"".activity_id, sa.activity_id)) = ""*SELECT* 1"".activity_id))
  • Join Filter: (("*SELECT* 1_1".date >= "*SELECT* 1".start_date) AND (("*SELECT* 1_1".date <= "*SELECT* 1".end_date) OR ("*SELECT* 1".end_date IS NULL)))
  • Rows Removed by Join Filter: 3234
6. 101.653 41,490.170 ↑ 11.7 9,262 1

Hash Join (cost=1,064,038.27..9,834,157.58 rows=108,228 width=108) (actual time=4,696.770..41,490.170 rows=9,262 loops=1)

  • Hash Cond: (projects.id = item_id.item_id)
7. 293.814 41,388.509 ↓ 3.9 850,568 1

Hash Join (cost=1,064,036.01..9,832,261.33 rows=216,456 width=108) (actual time=2,471.489..41,388.509 rows=850,568 loops=1)

  • Hash Cond: (projects.account_id = accounts.id)
8. 162.247 41,094.577 ↓ 1.7 1,116,748 1

Append (cost=1,064,017.34..9,824,024.00 rows=649,367 width=136) (actual time=2,471.367..41,094.577 rows=1,116,748 loops=1)

9. 657.761 40,628.647 ↓ 2.7 1,087,842 1

Hash Join (cost=1,064,017.34..9,303,138.91 rows=404,209 width=108) (actual time=2,471.366..40,628.647 rows=1,087,842 loops=1)

  • Hash Cond: (projects.account_id = accounts_1.id)
  • Join Filter: ((((""*SELECT* 1_1"".vacation_user_id)::double precision) IS NULL) OR (((""*SELECT* 1_1"".vacation_hours)::double precision) < (COALESCE(sa.capacity, accounts_1.default_capacity))::double precision))
  • Rows Removed by Join Filter: 13596
10. 541.547 39,970.723 ↑ 1.1 1,101,438 1

Hash Left Join (cost=1,063,998.38..9,284,792.06 rows=1,200,621 width=144) (actual time=2,456.111..39,970.723 rows=1,101,438 loops=1)

  • Hash Cond: ((projects.account_id = sa.account_id) AND ("*SELECT* 1_1".user_id = sa.user_id))
  • Join Filter: (("*SELECT* 1_1".date >= sa.start_date) AND ("*SELECT* 1_1".date <= sa.end_date))
  • Rows Removed by Join Filter: 259092
11. 377.881 39,413.351 ↑ 1.1 1,101,438 1

Hash Join (cost=1,063,002.52..8,000,532.41 rows=1,200,621 width=120) (actual time=2,440.235..39,413.351 rows=1,101,438 loops=1)

  • Hash Cond: ("*SELECT* 1_1".project_id = projects.id)
12. 165.401 39,033.398 ↑ 1.1 1,101,438 1

Append (cost=1,062,773.75..7,985,143.50 rows=1,200,621 width=116) (actual time=2,438.154..39,033.398 rows=1,101,438 loops=1)

13. 169.166 24,608.525 ↑ 1.3 396,845 1

Result (cost=1,062,773.75..7,787,654.85 rows=496,660 width=116) (actual time=2,438.153..24,608.525 rows=396,845 loops=1)

14. 54.564 24,439.359 ↑ 1.3 396,845 1

Append (cost=1,062,773.75..7,781,446.60 rows=496,660 width=140) (actual time=2,438.150..24,439.359 rows=396,845 loops=1)

15. 75.900 4,796.641 ↑ 1.4 338,629 1

Subquery Scan on *SELECT* 1_1 (cost=1,062,773.75..7,714,854.75 rows=457,222 width=114) (actual time=2,438.150..4,796.641 rows=338,629 loops=1)

16. 2,257.911 4,720.741 ↑ 1.4 338,629 1

Hash Right Join (cost=1,062,773.75..7,707,996.42 rows=457,222 width=134) (actual time=2,438.148..4,720.741 rows=338,629 loops=1)

  • Hash Cond: ((staff_memberships.account_id = projects_1.account_id) AND (staff_memberships.user_id = plan_rows.user_id))
  • Join Filter: (generate_series.generate_series = ((generate_series_1.generate_series)::date))
  • Rows Removed by Join Filter: 14110732
17. 45.681 104.584 ↑ 17.8 32,266 1

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

  • Group Key: generate_series_1.generate_series, staff_memberships.user_id, staff_memberships.account_id
18. 13.848 58.903 ↑ 134.2 32,422 1

Hash Join (cost=138.05..493,700.50 rows=4,351,382 width=21) (actual time=1.981..58.903 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: 1908
19. 18.528 43.137 ↑ 634.8 34,330 1

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

20. 2.817 2.817 ↑ 1.0 21,792 1

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

21. 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)

22. 0.997 1.918 ↑ 1.0 4,002 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 229kB
23. 0.921 0.921 ↑ 1.0 4,002 1

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

24. 151.492 2,358.246 ↑ 1.4 338,629 1

Hash (cost=518,701.10..518,701.10 rows=457,222 width=66) (actual time=2,358.246..2,358.246 rows=338,629 loops=1)

  • Buckets: 524288 Batches: 1 Memory Usage: 38679kB
25. 1,203.406 2,206.754 ↑ 1.4 338,629 1

Hash Anti Join (cost=463,568.36..518,701.10 rows=457,222 width=66) (actual time=771.526..2,206.754 rows=338,629 loops=1)

  • Hash Cond: ((projects_1.account_id = non_working_intervals_by_dates.account_id) AND (plan_rows.user_id = non_working_intervals_by_dates.user_id))
  • Join Filter: (generate_series.generate_series = non_working_intervals_by_dates.date)
  • Rows Removed by Join Filter: 11449923
26. 184.116 973.269 ↑ 1.7 346,275 1

Hash Right Join (cost=461,391.56..465,319.85 rows=577,750 width=66) (actual time=741.417..973.269 rows=346,275 loops=1)

  • Hash Cond: ((plan_rows_1.project_plan_id = project_plans.id) AND (((min(((plan_rows_1.uuid)::character varying)::text))::uuid) = plan_items.plan_row_uuid) AND (plan_rows_1.user_id = plan_rows.user_id))
  • Join Filter: (((plan_rows_1.epic_id = plan_rows.epic_id) OR (plan_rows.epic_id IS NULL)) AND ((generate_series.generate_series)::date >= (COALESCE(plan_roles.start_date, '1980-01-01'::date))) AND ((generate_series.generate_series)::date <= (COALESCE(lag((plan_roles.start_date - 1), 1) OVER (?), '3000-01-01'::date))))
  • Rows Removed by Join Filter: 3247
27. 90.087 205.055 ↓ 9.0 44,428 1

HashAggregate (cost=8,529.07..8,603.30 rows=4,949 width=48) (actual time=153.144..205.055 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)
28. 38.936 114.968 ↑ 1.0 44,581 1

WindowAgg (cost=6,077.00..7,080.12 rows=44,583 width=68) (actual time=69.048..114.968 rows=44,581 loops=1)

29. 28.622 76.032 ↑ 1.0 44,581 1

Sort (cost=6,077.00..6,188.46 rows=44,583 width=52) (actual time=69.034..76.032 rows=44,581 loops=1)

  • Sort Key: plan_roles.plan_row_uuid, plan_roles.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 5023kB
30. 19.083 47.410 ↑ 1.0 44,581 1

Hash Join (cost=1,631.38..2,634.26 rows=44,583 width=52) (actual time=23.426..47.410 rows=44,581 loops=1)

  • Hash Cond: (plan_roles.plan_row_uuid = plan_rows_1.uuid)
31. 5.204 5.204 ↑ 1.0 44,581 1

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

32. 12.870 23.123 ↑ 1.0 48,106 1

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

  • Buckets: 65536 Batches: 1 Memory Usage: 3180kB
33. 10.253 10.253 ↑ 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.007..10.253 rows=48,106 loops=1)

34. 163.619 584.098 ↑ 1.7 346,275 1

Hash (cost=442,751.87..442,751.87 rows=577,750 width=70) (actual time=584.097..584.098 rows=346,275 loops=1)

  • Buckets: 1048576 Batches: 1 Memory Usage: 45544kB
35. 68.097 420.479 ↑ 1.7 346,275 1

Nested Loop (cost=1,989.96..442,751.87 rows=577,750 width=70) (actual time=25.253..420.479 rows=346,275 loops=1)

36. 10.342 79.762 ↓ 1.2 27,262 1

Hash Join (cost=1,989.96..3,661.86 rows=23,110 width=70) (actual time=25.235..79.762 rows=27,262 loops=1)

  • Hash Cond: (project_plans.project_id = projects_1.id)
37. 13.831 67.379 ↓ 1.2 27,262 1

Hash Join (cost=1,761.19..3,372.38 rows=23,110 width=66) (actual time=23.145..67.379 rows=27,262 loops=1)

  • Hash Cond: (plan_items.plan_row_uuid = plan_rows.uuid)
38. 16.424 32.641 ↓ 1.1 29,797 1

Hash Join (cost=202.03..1,744.27 rows=26,265 width=54) (actual time=1.866..32.641 rows=29,797 loops=1)

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

Seq Scan on plan_items (cost=0.00..1,396.10 rows=55,634 width=46) (actual time=0.010..14.390 rows=55,664 loops=1)

  • Filter: (utilization > '0'::numeric)
  • Rows Removed by Filter: 264
40. 0.543 1.827 ↑ 1.0 2,851 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 144kB
41. 1.284 1.284 ↑ 1.0 2,851 1

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

  • Filter: active
  • Rows Removed by Filter: 3188
42. 10.989 20.907 ↓ 1.0 42,344 1

Hash (cost=1,030.06..1,030.06 rows=42,328 width=28) (actual time=20.907..20.907 rows=42,344 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 2816kB
43. 9.918 9.918 ↓ 1.0 42,344 1

Seq Scan on plan_rows (cost=0.00..1,030.06 rows=42,328 width=28) (actual time=0.018..9.918 rows=42,344 loops=1)

  • Filter: (user_id IS NOT NULL)
  • Rows Removed by Filter: 5762
44. 1.037 2.041 ↑ 1.0 5,812 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 292kB
45. 1.004 1.004 ↑ 1.0 5,812 1

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

46. 272.620 272.620 ↑ 1.9 13 27,262

Function Scan on generate_series (cost=0.01..18.76 rows=25 width=8) (actual time=0.004..0.010 rows=13 loops=27,262)

  • Filter: (date_part('dow'::text, generate_series) = ANY ('{1,2,3,4,5}'::double precision[]))
  • Rows Removed by Filter: 5
47. 15.480 30.079 ↑ 1.0 58,975 1

Hash (cost=1,281.12..1,281.12 rows=59,712 width=12) (actual time=30.079..30.079 rows=58,975 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3047kB
48. 14.599 14.599 ↑ 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.012..14.599 rows=59,712 loops=1)

49. 55.853 19,588.154 ↓ 1.5 58,216 1

Hash Join (cost=1,222.88..63,714.17 rows=39,438 width=114) (actual time=7.826..19,588.154 rows=58,216 loops=1)

  • Hash Cond: (project_plans_1.project_id = project.id)
  • Join Filter: (NOT (SubPlan 1))
  • Rows Removed by Join Filter: 770
50. 21.284 122.988 ↑ 1.3 58,986 1

Nested Loop (cost=994.11..62,498.81 rows=78,875 width=58) (actual time=4.841..122.988 rows=58,986 loops=1)

51. 2.985 38.329 ↑ 1.2 2,535 1

Hash Join (cost=994.10..2,553.80 rows=3,155 width=58) (actual time=4.825..38.329 rows=2,535 loops=1)

  • Hash Cond: (plan_items_1.project_plan_id = project_plans_1.id)
52. 17.468 33.791 ↓ 1.2 7,876 1

Hash Join (cost=792.07..2,334.22 rows=6,682 width=54) (actual time=3.235..33.791 rows=7,876 loops=1)

  • Hash Cond: (plan_items_1.plan_row_uuid = plan_rows_2.uuid)
53. 13.161 13.161 ↓ 1.0 55,664 1

Seq Scan on plan_items plan_items_1 (cost=0.00..1,396.10 rows=55,634 width=46) (actual time=0.010..13.161 rows=55,664 loops=1)

  • Filter: (utilization > '0'::numeric)
  • Rows Removed by Filter: 264
54. 1.259 3.162 ↑ 1.0 5,762 1

Hash (cost=719.85..719.85 rows=5,778 width=24) (actual time=3.162..3.162 rows=5,762 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 366kB
55. 1.593 1.903 ↑ 1.0 5,762 1

Bitmap Heap Scan on plan_rows plan_rows_2 (cost=113.07..719.85 rows=5,778 width=24) (actual time=0.376..1.903 rows=5,762 loops=1)

  • Recheck Cond: (user_id IS NULL)
  • Heap Blocks: exact=430
56. 0.310 0.310 ↑ 1.0 5,762 1

Bitmap Index Scan on index_plan_rows_on_user_id (cost=0.00..111.63 rows=5,778 width=0) (actual time=0.310..0.310 rows=5,762 loops=1)

  • Index Cond: (user_id IS NULL)
57. 0.452 1.553 ↑ 1.0 2,851 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 144kB
58. 1.101 1.101 ↑ 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.007..1.101 rows=2,851 loops=1)

  • Filter: active
  • Rows Removed by Filter: 3188
59. 63.375 63.375 ↑ 1.1 23 2,535

Function Scan on generate_series generate_series_2 (cost=0.01..18.76 rows=25 width=8) (actual time=0.009..0.025 rows=23 loops=2,535)

  • Filter: (date_part('dow'::text, generate_series) = ANY ('{1,2,3,4,5}'::double precision[]))
  • Rows Removed by Filter: 9
60. 1.303 2.919 ↑ 1.0 5,812 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 314kB
61. 1.616 1.616 ↑ 1.0 5,812 1

Seq Scan on projects project (cost=0.00..156.12 rows=5,812 width=12) (actual time=0.034..1.616 rows=5,812 loops=1)

62.          

SubPlan (for Hash Join)

63. 58.986 19,406.394 ↓ 0.0 0 58,986

Nested Loop (cost=0.69..97.27 rows=1 width=0) (actual time=0.329..0.329 rows=0 loops=58,986)

  • Join Filter: (non_working_intervals_by_dates_2.office_id = clients_3.office_id)
  • Rows Removed by Join Filter: 3
64. 117.972 117.972 ↑ 1.0 1 58,986

Index Scan using clients_pkey on clients clients_3 (cost=0.28..8.29 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=58,986)

  • Index Cond: (project.client_id = id)
65. 19,229.436 19,229.436 ↑ 4.0 3 58,986

Index Scan using non_working_intervals_by_dates_idx on non_working_intervals_by_dates non_working_intervals_by_dates_2 (cost=0.41..88.82 rows=12 width=4) (actual time=0.317..0.326 rows=3 loops=58,986)

  • Index Cond: ((project.account_id = account_id) AND (generate_series_2.generate_series = date))
66. 13,397.828 14,259.472 ↓ 1.0 704,593 1

Hash Right Join (cost=45,029.23..184,445.93 rows=703,961 width=116) (actual time=793.977..14,259.472 rows=704,593 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 = active_plan.id))))
  • Rows Removed by Join Filter: 62978265
67. 106.432 216.170 ↓ 9.0 44,428 1

HashAggregate (cost=8,529.07..8,603.30 rows=4,949 width=48) (actual time=144.584..216.170 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)
68. 34.894 109.738 ↑ 1.0 44,581 1

WindowAgg (cost=6,077.00..7,080.12 rows=44,583 width=68) (actual time=68.379..109.738 rows=44,581 loops=1)

69. 28.472 74.844 ↑ 1.0 44,581 1

Sort (cost=6,077.00..6,188.46 rows=44,583 width=52) (actual time=68.370..74.844 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: 5023kB
70. 18.424 46.372 ↑ 1.0 44,581 1

Hash Join (cost=1,631.38..2,634.26 rows=44,583 width=52) (actual time=22.986..46.372 rows=44,581 loops=1)

  • Hash Cond: (plan_roles_1.plan_row_uuid = plan_rows_3.uuid)
71. 5.225 5.225 ↑ 1.0 44,581 1

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

72. 12.552 22.723 ↑ 1.0 48,106 1

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

  • Buckets: 65536 Batches: 1 Memory Usage: 3180kB
73. 10.171 10.171 ↑ 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.006..10.171 rows=48,106 loops=1)

74. 231.138 645.474 ↑ 1.0 703,961 1

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

  • Buckets: 1048576 Batches: 1 Memory Usage: 61640kB
75. 295.576 414.336 ↑ 1.0 703,961 1

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

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

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

77. 6.711 19.918 ↑ 1.0 26,435 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 1424kB
78. 8.601 13.207 ↑ 1.0 26,435 1

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

  • Hash Cond: (epics.project_id = active_plan.project_id)
79. 3.110 3.110 ↑ 1.0 26,435 1

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

80. 0.431 1.496 ↑ 1.0 2,851 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 144kB
81. 1.065 1.065 ↑ 1.0 2,851 1

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

  • Filter: active
  • Rows Removed by Filter: 3188
82. 1.103 2.072 ↑ 1.0 5,812 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 292kB
83. 0.969 0.969 ↑ 1.0 5,812 1

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

84. 1.401 15.825 ↑ 1.0 4,221 1

Hash (cost=932.12..932.12 rows=4,249 width=40) (actual time=15.824..15.825 rows=4,221 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 370kB
85. 0.975 14.424 ↑ 1.0 4,221 1

Subquery Scan on sa (cost=847.14..932.12 rows=4,249 width=40) (actual time=12.155..14.424 rows=4,221 loops=1)

86. 0.930 13.449 ↑ 1.0 4,221 1

Unique (cost=847.14..889.63 rows=4,249 width=65) (actual time=12.152..13.449 rows=4,221 loops=1)

87. 3.233 12.519 ↑ 1.0 4,249 1

Sort (cost=847.14..857.76 rows=4,249 width=65) (actual time=12.151..12.519 rows=4,249 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
88. 3.124 9.286 ↑ 1.0 4,249 1

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

89. 2.518 6.162 ↑ 1.0 4,249 1

Sort (cost=484.85..495.47 rows=4,249 width=56) (actual time=5.829..6.162 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
90. 1.417 3.644 ↑ 1.0 4,249 1

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

  • Hash Cond: (staff_membership_activity_links.staff_membership_id = staff_memberships_1.id)
91. 0.414 0.414 ↑ 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.010..0.414 rows=4,256 loops=1)

92. 0.951 1.813 ↑ 1.0 4,002 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 276kB
93. 0.862 0.862 ↑ 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.006..0.862 rows=4,002 loops=1)

94. 0.078 0.163 ↑ 1.0 354 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
95. 0.085 0.085 ↑ 1.0 354 1

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

96. 10.255 303.683 ↑ 8.5 28,906 1

Subquery Scan on *SELECT* 2_1 (cost=424,372.25..513,596.17 rows=245,158 width=136) (actual time=108.675..303.683 rows=28,906 loops=1)

97. 168.186 293.428 ↑ 8.5 28,906 1

Hash Anti Join (cost=424,372.25..510,531.69 rows=245,158 width=143) (actual time=108.672..293.428 rows=28,906 loops=1)

  • Hash Cond: ((staff_memberships_2.account_id = non_working_intervals_by_dates_1.account_id) AND (staff_memberships_2.user_id = non_working_intervals_by_dates_1.user_id))
  • Join Filter: (generate_series_3.generate_series = non_working_intervals_by_dates_1.date)
  • Rows Removed by Join Filter: 1153172
98. 19.205 96.818 ↑ 9.5 29,394 1

Hash Join (cost=422,195.45..490,256.83 rows=280,181 width=64) (actual time=80.139..96.818 rows=29,394 loops=1)

  • Hash Cond: (staff_memberships_2.id = vacations_1.staff_membership_id)
  • Join Filter: ((generate_series_3.generate_series >= (COALESCE(staff_membership_activity_links_1.start_date, staff_memberships_2.joined_at))) AND (generate_series_3.generate_series <= (COALESCE(lag((staff_membership_activity_links_1.start_date - 1), 1) OVER (?), staff_memberships_2.archived_at, '3000-01-01'::date))))
  • Rows Removed by Join Filter: 10924
99. 1.208 15.580 ↑ 1.0 4,221 1

Unique (cost=836.52..879.01 rows=4,249 width=65) (actual time=13.919..15.580 rows=4,221 loops=1)

100. 4.058 14.372 ↑ 1.0 4,249 1

Sort (cost=836.52..847.14 rows=4,249 width=65) (actual time=13.918..14.372 rows=4,249 loops=1)

  • Sort Key: staff_memberships_2.account_id, staff_memberships_2.user_id, (COALESCE(staff_membership_activity_links_1.start_date, staff_memberships_2.joined_at)), (COALESCE(lag((staff_membership_activity_links_1.start_date - 1), 1) OVER (?), staff_memberships_2.archived_at, '3000-01-01'::date)) DESC
  • Sort Method: quicksort Memory: 592kB
101. 3.832 10.314 ↑ 1.0 4,249 1

WindowAgg (cost=484.85..580.45 rows=4,249 width=65) (actual time=6.041..10.314 rows=4,249 loops=1)

102. 2.650 6.482 ↑ 1.0 4,249 1

Sort (cost=484.85..495.47 rows=4,249 width=44) (actual time=6.027..6.482 rows=4,249 loops=1)

  • Sort Key: staff_membership_activity_links_1.staff_membership_id, staff_membership_activity_links_1.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 561kB
103. 1.582 3.832 ↑ 1.0 4,249 1

Hash Join (cost=138.05..228.79 rows=4,249 width=44) (actual time=1.784..3.832 rows=4,249 loops=1)

  • Hash Cond: (staff_membership_activity_links_1.staff_membership_id = staff_memberships_2.id)
104. 0.492 0.492 ↑ 1.0 4,256 1

Seq Scan on staff_membership_activity_links staff_membership_activity_links_1 (cost=0.00..79.56 rows=4,256 width=20) (actual time=0.015..0.492 rows=4,256 loops=1)

105. 0.903 1.758 ↑ 1.0 4,002 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 245kB
106. 0.855 0.855 ↑ 1.0 4,002 1

Seq Scan on staff_memberships staff_memberships_2 (cost=0.00..88.02 rows=4,002 width=24) (actual time=0.007..0.855 rows=4,002 loops=1)

107. 10.647 62.033 ↑ 17.5 31,132 1

Hash (cost=414,548.93..414,548.93 rows=544,800 width=44) (actual time=62.033..62.033 rows=31,132 loops=1)

  • Buckets: 1048576 Batches: 1 Memory Usage: 10776kB
108. 5.232 51.386 ↑ 17.5 31,132 1

Nested Loop (cost=0.01..414,548.93 rows=544,800 width=44) (actual time=0.027..51.386 rows=31,132 loops=1)

109. 2.570 2.570 ↑ 1.0 21,792 1

Seq Scan on vacations vacations_1 (cost=0.00..500.92 rows=21,792 width=44) (actual time=0.012..2.570 rows=21,792 loops=1)

110. 43.584 43.584 ↑ 25.0 1 21,792

Function Scan on generate_series generate_series_3 (cost=0.01..18.76 rows=25 width=8) (actual time=0.001..0.002 rows=1 loops=21,792)

  • Filter: (date_part('dow'::text, generate_series) = ANY ('{1,2,3,4,5}'::double precision[]))
  • Rows Removed by Filter: 0
111. 15.363 28.424 ↑ 1.0 58,975 1

Hash (cost=1,281.12..1,281.12 rows=59,712 width=12) (actual time=28.424..28.424 rows=58,975 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3047kB
112. 13.061 13.061 ↑ 1.0 59,712 1

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

113. 0.003 0.118 ↑ 11.8 10 1

Hash (cost=17.20..17.20 rows=118 width=4) (actual time=0.118..0.118 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
114. 0.115 0.115 ↑ 11.8 10 1

Seq Scan on accounts (cost=0.00..17.20 rows=118 width=4) (actual time=0.016..0.115 rows=10 loops=1)

  • Filter: ((suspended_at)::date >= CURRENT_DATE)
  • Rows Removed by Filter: 344
115. 0.003 0.008 ↑ 9.1 11 1

Hash (cost=1.00..1.00 rows=100 width=4) (actual time=0.008..0.008 rows=11 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
116. 0.005 0.005 ↑ 9.1 11 1

Function Scan on unnest item_id (cost=0.00..1.00 rows=100 width=4) (actual time=0.004..0.005 rows=11 loops=1)

117. 91.958 395.988 ↑ 1.0 263,033 1

Hash (cost=23,393.30..23,393.30 rows=270,995 width=28) (actual time=395.988..395.988 rows=263,033 loops=1)

  • Buckets: 524288 Batches: 1 Memory Usage: 20457kB
118. 33.155 304.030 ↑ 1.0 263,033 1

Append (cost=109.73..23,393.30 rows=270,995 width=28) (actual time=2.062..304.030 rows=263,033 loops=1)

119. 0.101 17.698 ↓ 9.7 474 1

Subquery Scan on *SELECT* 1 (cost=109.73..1,692.49 rows=49 width=28) (actual time=2.061..17.698 rows=474 loops=1)

120. 0.262 17.597 ↓ 9.7 474 1

Nested Loop (cost=109.73..1,692.00 rows=49 width=612) (actual time=2.060..17.597 rows=474 loops=1)

121. 0.149 16.861 ↓ 9.7 474 1

Nested Loop (cost=109.59..1,683.84 rows=49 width=36) (actual time=2.050..16.861 rows=474 loops=1)

122. 0.098 1.622 ↓ 5.0 5 1

Nested Loop (cost=109.17..306.98 rows=1 width=24) (actual time=1.414..1.622 rows=5 loops=1)

  • Join Filter: (clients.brand_id = rate_cards.rateable_id)
  • Rows Removed by Join Filter: 570
123. 0.099 0.719 ↑ 1.0 115 1

WindowAgg (cost=108.61..111.49 rows=115 width=45) (actual time=0.623..0.719 rows=115 loops=1)

124. 0.055 0.620 ↑ 1.0 115 1

Sort (cost=108.61..108.90 rows=115 width=21) (actual time=0.610..0.620 rows=115 loops=1)

  • Sort Key: rate_cards.rateable_id, rate_cards.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 30kB
125. 0.565 0.565 ↑ 1.0 115 1

Seq Scan on rate_cards (cost=0.00..104.68 rows=115 width=21) (actual time=0.125..0.565 rows=115 loops=1)

  • Filter: ((rateable_type)::text = 'Brand'::text)
  • Rows Removed by Filter: 4739
126. 0.028 0.805 ↑ 1.0 5 115

Materialize (cost=0.56..185.73 rows=5 width=8) (actual time=0.004..0.007 rows=5 loops=115)

127. 0.004 0.777 ↑ 1.0 5 1

Nested Loop (cost=0.56..185.71 rows=5 width=8) (actual time=0.428..0.777 rows=5 loops=1)

128. 0.010 0.758 ↑ 1.0 5 1

Nested Loop (cost=0.28..184.13 rows=5 width=8) (actual time=0.421..0.758 rows=5 loops=1)

129. 0.733 0.733 ↑ 1.0 5 1

Seq Scan on pricing_models (cost=0.00..142.62 rows=5 width=4) (actual time=0.409..0.733 rows=5 loops=1)

  • Filter: ((rates_type)::text = 'brand'::text)
  • Rows Removed by Filter: 5805
130. 0.015 0.015 ↑ 1.0 1 5

Index Scan using projects_pkey on projects projects_2 (cost=0.28..8.30 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=5)

  • Index Cond: (id = pricing_models.project_id)
131. 0.015 0.015 ↑ 1.0 1 5

Index Scan using clients_pkey on clients (cost=0.28..0.32 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=5)

  • Index Cond: (id = projects_2.client_id)
132. 15.090 15.090 ↓ 1.9 95 5

Index Scan using index_rates_on_activity_id_and_rate_card_id on rates (cost=0.42..1,376.37 rows=49 width=20) (actual time=0.772..3.018 rows=95 loops=5)

  • Index Cond: (rate_card_id = rate_cards.id)
133. 0.474 0.474 ↑ 1.0 1 474

Index Only Scan using brands_pkey on brands (cost=0.14..0.17 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=474)

  • Index Cond: (id = clients.brand_id)
  • Heap Fetches: 474
134. 14.596 79.628 ↓ 2.6 91,600 1

Subquery Scan on *SELECT* 2 (cost=583.00..5,479.99 rows=35,024 width=28) (actual time=12.617..79.628 rows=91,600 loops=1)

135. 40.678 65.032 ↓ 2.6 91,600 1

Hash Join (cost=583.00..5,129.75 rows=35,024 width=612) (actual time=12.616..65.032 rows=91,600 loops=1)

  • Hash Cond: (rates_1.rate_card_id = rate_cards_1.id)
136. 18.881 18.881 ↑ 1.0 174,437 1

Seq Scan on rates rates_1 (cost=0.00..3,542.37 rows=174,437 width=20) (actual time=0.010..18.881 rows=174,437 loops=1)

137. 0.169 5.473 ↑ 1.1 657 1

Hash (cost=574.00..574.00 rows=720 width=16) (actual time=5.472..5.473 rows=657 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 39kB
138. 0.165 5.304 ↑ 1.1 657 1

Hash Join (cost=378.98..574.00 rows=720 width=16) (actual time=3.475..5.304 rows=657 loops=1)

  • Hash Cond: (clients_1.office_id = offices.id)
139. 0.190 3.296 ↑ 1.0 623 1

Hash Join (cost=214.02..399.80 rows=623 width=8) (actual time=1.628..3.296 rows=623 loops=1)

  • Hash Cond: (projects_3.client_id = clients_1.id)
140. 0.824 2.418 ↑ 1.0 623 1

Hash Join (cost=150.41..334.56 rows=623 width=8) (actual time=0.933..2.418 rows=623 loops=1)

  • Hash Cond: (projects_3.id = pricing_models_1.project_id)
141. 0.674 0.674 ↑ 1.0 5,812 1

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

142. 0.102 0.920 ↑ 1.0 623 1

Hash (cost=142.62..142.62 rows=623 width=4) (actual time=0.920..0.920 rows=623 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 30kB
143. 0.818 0.818 ↑ 1.0 623 1

Seq Scan on pricing_models pricing_models_1 (cost=0.00..142.62 rows=623 width=4) (actual time=0.014..0.818 rows=623 loops=1)

  • Filter: ((rates_type)::text = 'office'::text)
  • Rows Removed by Filter: 5187
144. 0.329 0.688 ↑ 1.0 1,849 1

Hash (cost=40.49..40.49 rows=1,849 width=8) (actual time=0.688..0.688 rows=1,849 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 89kB
145. 0.359 0.359 ↑ 1.0 1,849 1

Seq Scan on clients clients_1 (cost=0.00..40.49 rows=1,849 width=8) (actual time=0.010..0.359 rows=1,849 loops=1)

146. 0.142 1.843 ↑ 1.1 450 1

Hash (cost=158.85..158.85 rows=489 width=20) (actual time=1.843..1.843 rows=450 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
147. 0.138 1.701 ↑ 1.1 450 1

Hash Join (cost=140.44..158.85 rows=489 width=20) (actual time=1.142..1.701 rows=450 loops=1)

  • Hash Cond: (rate_cards_1.rateable_id = offices.id)
148. 0.398 1.359 ↑ 1.0 489 1

WindowAgg (cost=126.52..138.74 rows=489 width=45) (actual time=0.934..1.359 rows=489 loops=1)

149. 0.167 0.961 ↑ 1.0 489 1

Sort (cost=126.52..127.74 rows=489 width=21) (actual time=0.926..0.961 rows=489 loops=1)

  • Sort Key: rate_cards_1.rateable_id, rate_cards_1.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 48kB
150. 0.794 0.794 ↑ 1.0 489 1

Seq Scan on rate_cards rate_cards_1 (cost=0.00..104.68 rows=489 width=21) (actual time=0.170..0.794 rows=489 loops=1)

  • Filter: ((rateable_type)::text = 'Office'::text)
  • Rows Removed by Filter: 4365
151. 0.107 0.204 ↑ 1.0 441 1

Hash (cost=8.41..8.41 rows=441 width=4) (actual time=0.204..0.204 rows=441 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
152. 0.097 0.097 ↑ 1.0 441 1

Seq Scan on offices (cost=0.00..8.41 rows=441 width=4) (actual time=0.007..0.097 rows=441 loops=1)

153. 15.243 87.537 ↑ 2.2 94,593 1

Subquery Scan on *SELECT* 3 (cost=840.78..9,338.49 rows=204,158 width=28) (actual time=10.362..87.537 rows=94,593 loops=1)

154. 42.858 72.294 ↑ 2.2 94,593 1

Hash Join (cost=840.78..7,296.91 rows=204,158 width=612) (actual time=10.361..72.294 rows=94,593 loops=1)

  • Hash Cond: (rates_2.rate_card_id = rate_cards_2.id)
155. 19.110 19.110 ↑ 1.0 174,437 1

Seq Scan on rates rates_2 (cost=0.00..3,542.37 rows=174,437 width=20) (actual time=0.010..19.110 rows=174,437 loops=1)

156. 0.856 10.326 ↑ 1.0 4,004 1

Hash (cost=788.31..788.31 rows=4,197 width=16) (actual time=10.326..10.326 rows=4,004 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 252kB
157. 0.981 9.470 ↑ 1.0 4,004 1

Hash Join (cost=586.95..788.31 rows=4,197 width=16) (actual time=6.409..9.470 rows=4,004 loops=1)

  • Hash Cond: (projects_4.client_id = clients_2.id)
158. 1.124 4.418 ↑ 1.0 3,620 1

Hash Join (cost=228.77..380.91 rows=3,620 width=8) (actual time=2.332..4.418 rows=3,620 loops=1)

  • Hash Cond: (pricing_models_2.project_id = projects_4.id)
159. 1.031 1.031 ↑ 1.0 3,621 1

Seq Scan on pricing_models pricing_models_2 (cost=0.00..142.62 rows=3,621 width=4) (actual time=0.007..1.031 rows=3,621 loops=1)

  • Filter: ((rates_type)::text = 'client'::text)
  • Rows Removed by Filter: 2189
160. 0.976 2.263 ↑ 1.0 5,812 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 292kB
161. 1.287 1.287 ↑ 1.0 5,812 1

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

162. 0.421 4.071 ↑ 1.0 1,820 1

Hash (cost=335.42..335.42 rows=1,821 width=20) (actual time=4.071..4.071 rows=1,820 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 109kB
163. 0.426 3.650 ↑ 1.0 1,820 1

Hash Join (cost=266.89..335.42 rows=1,821 width=20) (actual time=1.875..3.650 rows=1,820 loops=1)

  • Hash Cond: (rate_cards_2.rateable_id = clients_2.id)
164. 1.214 2.805 ↑ 1.0 1,821 1

WindowAgg (cost=203.29..248.81 rows=1,821 width=45) (actual time=1.452..2.805 rows=1,821 loops=1)

165. 0.724 1.591 ↑ 1.0 1,821 1

Sort (cost=203.29..207.84 rows=1,821 width=21) (actual time=1.445..1.591 rows=1,821 loops=1)

  • Sort Key: rate_cards_2.rateable_id, rate_cards_2.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 146kB
166. 0.867 0.867 ↑ 1.0 1,821 1

Seq Scan on rate_cards rate_cards_2 (cost=0.00..104.68 rows=1,821 width=21) (actual time=0.006..0.867 rows=1,821 loops=1)

  • Filter: ((rateable_type)::text = 'Client'::text)
  • Rows Removed by Filter: 3033
167. 0.221 0.419 ↑ 1.0 1,849 1

Hash (cost=40.49..40.49 rows=1,849 width=4) (actual time=0.419..0.419 rows=1,849 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
168. 0.198 0.198 ↑ 1.0 1,849 1

Seq Scan on clients clients_2 (cost=0.00..40.49 rows=1,849 width=4) (actual time=0.006..0.198 rows=1,849 loops=1)

169. 13.712 86.012 ↓ 2.4 76,366 1

Subquery Scan on *SELECT* 4 (cost=695.56..5,527.35 rows=31,764 width=28) (actual time=8.098..86.012 rows=76,366 loops=1)

170. 43.180 72.300 ↓ 2.4 76,366 1

Hash Join (cost=695.56..5,209.71 rows=31,764 width=612) (actual time=8.097..72.300 rows=76,366 loops=1)

  • Hash Cond: (rates_3.rate_card_id = rate_cards_3.id)
171. 21.046 21.046 ↑ 1.0 174,437 1

Seq Scan on rates rates_3 (cost=0.00..3,542.37 rows=174,437 width=20) (actual time=0.010..21.046 rows=174,437 loops=1)

172. 0.354 8.074 ↓ 2.4 1,591 1

Hash (cost=687.40..687.40 rows=653 width=16) (actual time=8.074..8.074 rows=1,591 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 91kB
173. 1.091 7.720 ↓ 2.4 1,591 1

Hash Join (cost=502.95..687.40 rows=653 width=16) (actual time=5.942..7.720 rows=1,591 loops=1)

  • Hash Cond: (projects_5.id = pricing_models_3.project_id)
174. 0.699 0.699 ↑ 1.0 5,812 1

Seq Scan on projects projects_5 (cost=0.00..156.12 rows=5,812 width=4) (actual time=0.005..0.699 rows=5,812 loops=1)

175. 0.443 5.930 ↓ 2.4 1,591 1

Hash (cost=494.79..494.79 rows=653 width=16) (actual time=5.930..5.930 rows=1,591 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 91kB
176. 0.583 5.487 ↓ 2.4 1,591 1

Hash Join (cost=403.40..494.79 rows=653 width=16) (actual time=2.796..5.487 rows=1,591 loops=1)

  • Hash Cond: (rate_cards_3.rateable_id = pricing_models_3.id)
177. 1.914 3.801 ↑ 1.0 2,429 1

WindowAgg (cost=241.26..301.98 rows=2,429 width=45) (actual time=1.686..3.801 rows=2,429 loops=1)

178. 1.115 1.887 ↑ 1.0 2,429 1

Sort (cost=241.26..247.33 rows=2,429 width=21) (actual time=1.672..1.887 rows=2,429 loops=1)

  • Sort Key: rate_cards_3.rateable_id, rate_cards_3.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 286kB
179. 0.772 0.772 ↑ 1.0 2,429 1

Seq Scan on rate_cards rate_cards_3 (cost=0.00..104.68 rows=2,429 width=21) (actual time=0.009..0.772 rows=2,429 loops=1)

  • Filter: ((rateable_type)::text = 'PricingModel'::text)
  • Rows Removed by Filter: 2425
180. 0.250 1.103 ↑ 1.0 1,561 1

Hash (cost=142.62..142.62 rows=1,561 width=8) (actual time=1.103..1.103 rows=1,561 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 77kB
181. 0.853 0.853 ↑ 1.0 1,561 1

Seq Scan on pricing_models pricing_models_3 (cost=0.00..142.62 rows=1,561 width=8) (actual time=0.009..0.853 rows=1,561 loops=1)

  • Filter: ((rates_type)::text = 'custom'::text)
  • Rows Removed by Filter: 4249
Planning time : 7.141 ms
Execution time : 42,806.496 ms