explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YJRO

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 7.8 264,475 1

Subquery Scan on report_items_live (cost=2,187,159.81..2,190,389.43 rows=33,996 width=140) (actual rows=264,475 loops=1)

  • Buffers: shared hit=15732 read=7632
2. 0.000 0.000 ↓ 7.8 264,475 1

GroupAggregate (cost=2,187,159.81..2,190,049.47 rows=33,996 width=196) (actual rows=264,475 loops=1)

  • Group Key: items.account_id, items.project_id, items.project_plan_id, items.epic_id, items.activity_id, items.user_id, items.date, items.value, items.reportable_type, items.reportable_id, items.plan_row_uuid, ""*SELECT* 1"".currency, (COALESCE(exchange_rates_by_months.rate, '1'::double precision)), ""*SELECT* 1"".value, items.cost, (COALESCE(cost_exchange_rates.rate, '1'::double precision)), (COALESCE(original_exchange_rates.rate, '1'::double precision)), (GREATEST(items.updated_at, ""*SELECT* 1"".updated_at, ""*SELECT* 1"".rate_card_updated_at))
  • Buffers: shared hit=15732 read=7632
3. 0.000 0.000 ↓ 7.8 264,475 1

Sort (cost=2,187,159.81..2,187,244.80 rows=33,996 width=192) (actual rows=264,475 loops=1)

  • Sort Key: items.project_id, items.project_plan_id, items.epic_id, items.activity_id, items.user_id, items.date, items.value, items.reportable_type, items.reportable_id, items.plan_row_uuid, ""*SELECT* 1"".currency, (COALESCE(exchange_rates_by_months.rate, '1'::double precision)), ""*SELECT* 1"".value, items.cost, (COALESCE(cost_exchange_rates.rate, '1'::double precision)), (COALESCE(original_exchange_rates.rate, '1'::double precision)), (GREATEST(items.updated_at, ""*SELECT* 1"".updated_at, ""*SELECT* 1"".rate_card_updated_at))
  • Sort Method: quicksort Memory: 78051kB
  • Buffers: shared hit=15732 read=7632
4. 0.000 0.000 ↓ 7.8 264,475 1

Nested Loop (cost=2,178,405.78..2,184,601.09 rows=33,996 width=192) (actual rows=264,475 loops=1)

  • Buffers: shared hit=15732 read=7632
5. 0.000 0.000 ↑ 1.0 1 1

Index Scan using accounts_pkey on accounts (cost=0.15..8.17 rows=1 width=4) (actual rows=1 loops=1)

  • Index Cond: (id = 2)
  • Filter: ((suspended_at)::date >= CURRENT_DATE)
  • Buffers: shared hit=2
6. 0.000 0.000 ↓ 7.8 264,475 1

Merge Left Join (cost=2,178,405.63..2,184,167.97 rows=33,996 width=184) (actual rows=264,475 loops=1)

  • Merge Cond: (("*SELECT* 1".currency)::text = (original_exchange_rates.currency)::text)
  • Join Filter: ((original_exchange_rates.start_date <= items.date) AND (original_exchange_rates.end_date >= items.date) AND (original_exchange_rates.account_id = items.account_id))
  • Rows Removed by Join Filter: 19787993
  • Buffers: shared hit=15730 read=7632
7. 0.000 0.000 ↓ 7.8 264,475 1

Merge Left Join (cost=2,178,302.60..2,181,226.26 rows=33,996 width=176) (actual rows=264,475 loops=1)

  • Merge Cond: (("*SELECT* 1".currency)::text = (exchange_rates_by_months.currency)::text)
  • Join Filter: ((exchange_rates_by_months.start_date <= items.date) AND (exchange_rates_by_months.end_date >= items.date) AND (exchange_rates_by_months.account_id = items.account_id))
  • Rows Removed by Join Filter: 19787993
  • Buffers: shared hit=15689 read=7632
8. 0.000 0.000 ↓ 7.8 264,475 1

Sort (cost=2,178,199.57..2,178,284.56 rows=33,996 width=168) (actual rows=264,475 loops=1)

  • Sort Key: "*SELECT* 1".currency
  • Sort Method: quicksort Memory: 71920kB
  • Buffers: shared hit=15648 read=7632
9. 0.000 0.000 ↓ 7.8 264,475 1

Merge Left Join (cost=2,168,219.33..2,175,640.84 rows=33,996 width=168) (actual rows=264,475 loops=1)

  • Merge Cond: (items.project_id = discounts.project_id)
  • Join Filter: ((items.date >= discounts.start_date) AND (items.date <= discounts.end_date) AND (((discounts.discountable_id = items.user_id) AND ((discounts.discountable_type)::text = 'User'::text)) OR ((discounts.discountable_id = items.epic_id) AND ((discounts.discountable_type)::text = 'Epic'::text))))
  • Rows Removed by Join Filter: 453636
  • Buffers: shared hit=15648 read=7632
10. 0.000 0.000 ↓ 7.8 264,475 1

Merge Left Join (cost=2,168,196.56..2,173,972.67 rows=33,996 width=164) (actual rows=264,475 loops=1)

  • Merge Cond: ((items.project_id = "*SELECT* 1".project_id) AND (items.activity_id = "*SELECT* 1".activity_id))
  • Join Filter: ((items.date >= "*SELECT* 1".start_date) AND ((items.date <= "*SELECT* 1".end_date) OR ("*SELECT* 1".end_date IS NULL)))
  • Rows Removed by Join Filter: 216255
  • Buffers: shared hit=15644 read=7632
11. 0.000 0.000 ↓ 7.8 264,475 1

Sort (cost=2,121,365.65..2,121,450.64 rows=33,996 width=136) (actual rows=264,475 loops=1)

  • Sort Key: items.project_id, items.activity_id
  • Sort Method: quicksort Memory: 49480kB
  • Buffers: shared hit=6964 read=7632
12. 0.000 0.000 ↓ 7.8 264,475 1

Merge Left Join (cost=2,115,883.26..2,118,806.93 rows=33,996 width=136) (actual rows=264,475 loops=1)

  • Merge Cond: ((items.cost_currency)::text = (cost_exchange_rates.currency)::text)
  • Join Filter: ((cost_exchange_rates.start_date <= items.date) AND (cost_exchange_rates.end_date >= items.date) AND (cost_exchange_rates.account_id = items.account_id))
  • Rows Removed by Join Filter: 19424161
  • Buffers: shared hit=6964 read=7632
13. 0.000 0.000 ↓ 7.8 264,475 1

Sort (cost=2,115,780.23..2,115,865.22 rows=33,996 width=644) (actual rows=264,475 loops=1)

  • Sort Key: items.cost_currency
  • Sort Method: quicksort Memory: 49480kB
  • Buffers: shared hit=6923 read=7632
14. 0.000 0.000 ↓ 7.8 264,475 1

Subquery Scan on items (cost=1,951,405.97..2,113,221.51 rows=33,996 width=644) (actual rows=264,475 loops=1)

  • Buffers: shared hit=6923 read=7632
15. 0.000 0.000 ↓ 7.8 264,475 1

Append (cost=1,951,405.97..2,112,881.55 rows=33,996 width=644) (actual rows=264,475 loops=1)

  • Buffers: shared hit=6923 read=7632
16. 0.000 0.000 ↓ 7.7 262,693 1

Hash Left Join (cost=1,951,405.97..2,098,289.78 rows=33,995 width=103) (actual rows=262,693 loops=1)

  • Hash Cond: ("*SELECT* 1_1".project_plan_id = pa.project_plan_id)
  • Join Filter: (("*SELECT* 1_1".date >= pa.start_date) AND ("*SELECT* 1_1".date <= pa.end_date) AND ((pa.plan_row_uuid = "*SELECT* 1_1".plan_row_uuid) OR ("*SELECT* 1_1".plan_row_uuid IS NULL)) AND ((pa.user_id = "*SELECT* 1_1".user_id) OR ("*SELECT* 1_1".user_id IS NULL)) AND ((pa.epic_id = "*SELECT* 1_1".epic_id) OR ((('PlanItem'::text) = 'PlanItem'::text) AND ("*SELECT* 1_1".epic_id IS NULL)) OR ((('PlanItem'::text) = 'TimeLog'::text) AND (pa.epic_id IS NULL))))
  • Rows Removed by Join Filter: 5527270
  • Buffers: shared hit=6275 read=7632
17. 0.000 0.000 ↓ 7.7 262,693 1

Hash Left Join (cost=1,942,083.06..2,043,336.65 rows=33,995 width=149) (actual rows=262,693 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: 35554
  • Filter: ((((""*SELECT* 1_1"".vacation_hours)::double precision) IS NULL) OR (((""*SELECT* 1_1"".vacation_hours)::double precision) < (COALESCE(sa.capacity, accounts_1.default_capacity))::double precision))
  • Rows Removed by Filter: 749
  • Buffers: shared hit=5286 read=7632
18. 0.000 0.000 ↓ 2.6 263,442 1

Hash Left Join (cost=1,941,140.00..2,041,171.79 rows=100,976 width=125) (actual rows=263,442 loops=1)

  • Hash Cond: (projects.account_id = accounts_1.id)
  • Buffers: shared hit=5201 read=7632
19. 0.000 0.000 ↓ 2.6 263,442 1

Hash Join (cost=1,941,131.83..2,039,775.19 rows=100,976 width=120) (actual rows=263,442 loops=1)

  • Hash Cond: ("*SELECT* 1_1".project_id = projects.id)
  • Buffers: shared hit=5199 read=7632
20. 0.000 0.000 ↓ 2.2 1,596,015 1

Append (cost=1,940,994.69..2,030,601.04 rows=715,695 width=120) (actual rows=1,596,015 loops=1)

  • Buffers: shared hit=5155 read=7632
21. 0.000 0.000 ↓ 76.0 892,054 1

Subquery Scan on *SELECT* 1_1 (cost=1,940,994.69..1,988,762.50 rows=11,734 width=120) (actual rows=892,054 loops=1)

  • Buffers: shared hit=3171
22. 0.000 0.000 ↓ 76.0 892,054 1

Merge Right Join (cost=1,940,994.69..1,988,557.15 rows=11,734 width=138) (actual rows=892,054 loops=1)

  • Merge Cond: ((nw_intervals_by_dates_roles.office_id = clients.office_id) AND (nw_intervals_by_dates_roles.date = generate_series.generate_series) AND (nw_intervals_by_dates_roles.account_id = projects_1.account_id))
  • Filter: (COALESCE(non_working_intervals_by_dates.id, nw_intervals_by_dates_roles.id) IS NULL)
  • Rows Removed by Filter: 693191
  • Buffers: shared hit=3171
23. 0.000 0.000 ↑ 1.0 59,709 1

Sort (cost=6,017.99..6,167.27 rows=59,712 width=16) (actual rows=59,709 loops=1)

  • Sort Key: nw_intervals_by_dates_roles.office_id, nw_intervals_by_dates_roles.date, nw_intervals_by_dates_roles.account_id
  • Sort Method: quicksort Memory: 4336kB
  • Buffers: shared hit=684
24. 0.000 0.000 ↑ 1.0 59,712 1

Seq Scan on non_working_intervals_by_dates nw_intervals_by_dates_roles (cost=0.00..1,281.12 rows=59,712 width=16) (actual rows=59,712 loops=1)

  • Buffers: shared hit=684
25. 0.000 0.000 ↓ 1.2 1,585,245 1

Sort (cost=1,934,976.70..1,938,317.13 rows=1,336,175 width=110) (actual rows=1,585,245 loops=1)

  • Sort Key: clients.office_id, generate_series.generate_series, projects_1.account_id
  • Sort Method: quicksort Memory: 151406kB
  • Buffers: shared hit=2487
26. 0.000 0.000 ↑ 1.5 901,901 1

Merge Left Join (cost=1,768,724.66..1,799,023.04 rows=1,336,175 width=110) (actual rows=901,901 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))
  • Buffers: shared hit=2487
27. 0.000 0.000 ↑ 1.5 901,825 1

Merge Left Join (cost=1,762,706.67..1,781,902.75 rows=1,336,175 width=106) (actual rows=901,825 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))
  • Buffers: shared hit=1803
28. 0.000 0.000 ↑ 1.5 901,825 1

Sort (cost=1,156,109.39..1,159,449.83 rows=1,336,175 width=70) (actual rows=901,825 loops=1)

  • Sort Key: generate_series.generate_series, projects_1.account_id, plan_rows.user_id
  • Sort Method: quicksort Memory: 151396kB
  • Buffers: shared hit=1472
29. 0.000 0.000 ↑ 1.5 901,825 1

Nested Loop (cost=2,102.11..1,020,155.74 rows=1,336,175 width=70) (actual rows=901,825 loops=1)

  • Buffers: shared hit=1472
30. 0.000 0.000 ↓ 1.0 55,661 1

Hash Left Join (cost=2,102.10..4,662.73 rows=53,447 width=70) (actual rows=55,661 loops=1)

  • Hash Cond: (projects_1.client_id = clients.id)
  • Buffers: shared hit=1472
31. 0.000 0.000 ↓ 1.0 55,661 1

Hash Left Join (cost=2,038.50..4,458.51 rows=53,447 width=70) (actual rows=55,661 loops=1)

  • Hash Cond: (project_plans.project_id = projects_1.id)
  • Buffers: shared hit=1450
32. 0.000 0.000 ↓ 1.0 55,661 1

Hash Left Join (cost=1,809.73..4,089.34 rows=53,447 width=62) (actual rows=55,661 loops=1)

  • Hash Cond: (plan_items.project_plan_id = project_plans.id)
  • Buffers: shared hit=1352
33. 0.000 0.000 ↓ 1.0 55,661 1

Hash Join (cost=1,607.70..3,746.91 rows=53,447 width=58) (actual rows=55,661 loops=1)

  • Hash Cond: (plan_items.plan_row_uuid = plan_rows.uuid)
  • Buffers: shared hit=1246
34. 0.000 0.000 ↓ 1.0 55,664 1

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

  • Filter: (utilization > '0'::numeric)
  • Rows Removed by Filter: 264
  • Buffers: shared hit=697
35. 0.000 0.000 ↓ 1.0 48,102 1

Hash (cost=1,030.06..1,030.06 rows=46,211 width=28) (actual rows=48,102 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3117kB
  • Buffers: shared hit=549
36. 0.000 0.000 ↓ 1.0 48,102 1

Seq Scan on plan_rows (cost=0.00..1,030.06 rows=46,211 width=28) (actual rows=48,102 loops=1)

  • Filter: ((user_id IS NOT NULL) OR (activity_id IS NOT NULL))
  • Rows Removed by Filter: 4
  • Buffers: shared hit=549
37. 0.000 0.000 ↑ 1.0 2,851 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 144kB
  • Buffers: shared hit=106
38. 0.000 0.000 ↑ 1.0 2,851 1

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

  • Filter: active
  • Rows Removed by Filter: 3188
  • Buffers: shared hit=106
39. 0.000 0.000 ↑ 1.0 5,812 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 314kB
  • Buffers: shared hit=98
40. 0.000 0.000 ↑ 1.0 5,812 1

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

  • Buffers: shared hit=98
41. 0.000 0.000 ↑ 1.0 1,849 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 89kB
  • Buffers: shared hit=22
42. 0.000 0.000 ↑ 1.0 1,849 1

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

  • Buffers: shared hit=22
43. 0.000 0.000 ↑ 1.6 16 55,661

Function Scan on generate_series (cost=0.01..18.76 rows=25 width=8) (actual rows=16 loops=55,661)

  • Filter: (date_part('dow'::text, generate_series) = ANY ('{1,2,3,4,5}'::double precision[]))
  • Rows Removed by Filter: 6
44. 0.000 0.000 ↑ 15.4 37,319 1

Sort (cost=606,597.28..608,034.78 rows=575,000 width=44) (actual rows=37,319 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: 2844kB
  • Buffers: shared hit=331
45. 0.000 0.000 ↑ 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 rows=32,266 loops=1)

  • Buffers: shared hit=331
46. 0.000 0.000 ↑ 17.8 32,266 1

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

  • Group Key: generate_series_1.generate_series, staff_memberships.user_id, staff_memberships.account_id
  • Buffers: shared hit=331
47. 0.000 0.000 ↑ 134.2 32,422 1

Hash Join (cost=138.05..493,700.50 rows=4,351,382 width=21) (actual 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
  • Buffers: shared hit=331
48. 0.000 0.000 ↑ 634.8 34,330 1

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

  • Buffers: shared hit=283
49. 0.000 0.000 ↑ 1.0 21,792 1

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

  • Buffers: shared hit=283
50. 0.000 0.000 ↑ 500.0 2 21,792

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

51. 0.000 0.000 ↑ 1.0 4,002 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 229kB
  • Buffers: shared hit=48
52. 0.000 0.000 ↑ 1.0 4,002 1

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

  • Buffers: shared hit=48
53. 0.000 0.000 ↓ 1.0 62,082 1

Sort (cost=6,017.99..6,167.27 rows=59,712 width=16) (actual rows=62,082 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: 4336kB
  • Buffers: shared hit=684
54. 0.000 0.000 ↑ 1.0 59,712 1

Seq Scan on non_working_intervals_by_dates (cost=0.00..1,281.12 rows=59,712 width=16) (actual rows=59,712 loops=1)

  • Buffers: shared hit=684
55. 0.000 0.000 ↑ 1.0 703,961 1

Hash Join (cost=1,826.58..31,220.45 rows=703,961 width=120) (actual rows=703,961 loops=1)

  • Hash Cond: (time_logs.epic_id = epics.id)
  • Buffers: shared hit=1984 read=7632
56. 0.000 0.000 ↑ 1.0 703,961 1

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

  • Buffers: shared hit=1523 read=7632
57. 0.000 0.000 ↑ 1.0 26,435 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 1381kB
  • Buffers: shared hit=461
58. 0.000 0.000 ↑ 1.0 26,435 1

Hash Left Join (cost=202.03..1,496.14 rows=26,435 width=16) (actual 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: 11144
  • Buffers: shared hit=461
59. 0.000 0.000 ↑ 1.0 26,435 1

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

  • Buffers: shared hit=355
60. 0.000 0.000 ↑ 1.0 2,851 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 144kB
  • Buffers: shared hit=106
61. 0.000 0.000 ↑ 1.0 2,851 1

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

  • Filter: active
  • Rows Removed by Filter: 3188
  • Buffers: shared hit=106
62. 0.000 0.000 ↑ 1.0 820 1

Hash (cost=126.89..126.89 rows=820 width=8) (actual rows=820 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 41kB
  • Buffers: shared hit=44
63. 0.000 0.000 ↑ 1.0 820 1

Bitmap Heap Scan on projects (cost=18.64..126.89 rows=820 width=8) (actual rows=820 loops=1)

  • Recheck Cond: (account_id = 2)
  • Heap Blocks: exact=40
  • Buffers: shared hit=44
64. 0.000 0.000 ↑ 1.0 820 1

Bitmap Index Scan on index_projects_on_account_id (cost=0.00..18.43 rows=820 width=0) (actual rows=820 loops=1)

  • Index Cond: (account_id = 2)
  • Buffers: shared hit=4
65. 0.000 0.000 ↑ 1.0 1 1

Hash (cost=8.17..8.17 rows=1 width=9) (actual rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=2
66. 0.000 0.000 ↑ 1.0 1 1

Index Scan using accounts_pkey on accounts accounts_1 (cost=0.15..8.17 rows=1 width=9) (actual rows=1 loops=1)

  • Index Cond: (id = 2)
  • Buffers: shared hit=2
67. 0.000 0.000 ↓ 9.3 195 1

Hash (cost=942.74..942.74 rows=21 width=40) (actual rows=195 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
  • Buffers: shared hit=85
68. 0.000 0.000 ↓ 9.3 195 1

Subquery Scan on sa (cost=847.14..942.74 rows=21 width=40) (actual rows=195 loops=1)

  • Filter: (sa.account_id = 2)
  • Rows Removed by Filter: 4026
  • Buffers: shared hit=85
69. 0.000 0.000 ↑ 1.0 4,221 1

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

  • Buffers: shared hit=85
70. 0.000 0.000 ↑ 1.0 4,249 1

Sort (cost=847.14..857.76 rows=4,249 width=65) (actual 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
  • Buffers: shared hit=85
71. 0.000 0.000 ↑ 1.0 4,249 1

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

  • Buffers: shared hit=85
72. 0.000 0.000 ↑ 1.0 4,249 1

Sort (cost=484.85..495.47 rows=4,249 width=56) (actual 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
  • Buffers: shared hit=85
73. 0.000 0.000 ↑ 1.0 4,249 1

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

  • Hash Cond: (staff_membership_activity_links.staff_membership_id = staff_memberships_1.id)
  • Buffers: shared hit=85
74. 0.000 0.000 ↑ 1.0 4,256 1

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

  • Buffers: shared hit=37
75. 0.000 0.000 ↑ 1.0 4,002 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 276kB
  • Buffers: shared hit=48
76. 0.000 0.000 ↑ 1.0 4,002 1

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

  • Buffers: shared hit=48
77. 0.000 0.000 ↓ 8.9 44,428 1

Hash (cost=9,260.77..9,260.77 rows=4,971 width=48) (actual rows=44,428 loops=1)

  • Buckets: 65536 (originally 8192) Batches: 1 (originally 1) Memory Usage: 3912kB
  • Buffers: shared hit=989
78. 0.000 0.000 ↓ 8.9 44,428 1

Subquery Scan on pa (cost=9,136.50..9,260.77 rows=4,971 width=48) (actual rows=44,428 loops=1)

  • Buffers: shared hit=989
79. 0.000 0.000 ↓ 8.9 44,428 1

HashAggregate (cost=9,136.50..9,211.06 rows=4,971 width=48) (actual 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)
  • Buffers: shared hit=989
80. 0.000 0.000 ↑ 1.0 44,581 1

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

  • Buffers: shared hit=989
81. 0.000 0.000 ↑ 1.0 44,581 1

Sort (cost=6,572.98..6,684.43 rows=44,583 width=60) (actual rows=44,581 loops=1)

  • Sort Key: plan_roles.plan_row_uuid, plan_roles.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 7154kB
  • Buffers: shared hit=989
82. 0.000 0.000 ↑ 1.0 44,581 1

Hash Join (cost=1,631.38..3,130.23 rows=44,583 width=60) (actual rows=44,581 loops=1)

  • Hash Cond: (plan_roles.plan_row_uuid = plan_rows_1.uuid)
  • Buffers: shared hit=989
83. 0.000 0.000 ↑ 1.0 44,583 1

Seq Scan on plan_roles (cost=0.00..885.83 rows=44,583 width=32) (actual rows=44,583 loops=1)

  • Buffers: shared hit=440
84. 0.000 0.000 ↑ 1.0 48,106 1

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

  • Buckets: 65536 Batches: 1 Memory Usage: 3180kB
  • Buffers: shared hit=549
85. 0.000 0.000 ↑ 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 rows=48,106 loops=1)

  • Buffers: shared hit=549
86. 0.000 0.000 ↓ 1,782.0 1,782 1

Subquery Scan on *SELECT* 2_1 (cost=13,926.83..14,081.84 rows=1 width=103) (actual rows=1,782 loops=1)

  • Buffers: shared hit=648
87. 0.000 0.000 ↓ 1,782.0 1,782 1

Merge Left Join (cost=13,926.83..14,081.82 rows=1 width=110) (actual rows=1,782 loops=1)

  • Merge Cond: ((staff_memberships_2.user_id = non_working_intervals_by_dates_1.user_id) AND (generate_series_2.generate_series = non_working_intervals_by_dates_1.date))
  • Join Filter: (staff_memberships_2.account_id = non_working_intervals_by_dates_1.account_id)
  • Filter: (non_working_intervals_by_dates_1.id IS NULL)
  • Rows Removed by Filter: 43
  • Buffers: shared hit=648
88. 0.000 0.000 ↑ 7.5 1,825 1

Sort (cost=12,565.40..12,599.54 rows=13,657 width=64) (actual rows=1,825 loops=1)

  • Sort Key: staff_memberships_2.user_id, generate_series_2.generate_series
  • Sort Method: quicksort Memory: 305kB
  • Buffers: shared hit=539
89. 0.000 0.000 ↑ 7.5 1,825 1

Nested Loop (cost=1,028.07..11,627.34 rows=13,657 width=64) (actual rows=1,825 loops=1)

  • Buffers: shared hit=539
90. 0.000 0.000 ↑ 1.8 310 1

Nested Loop (cost=1,028.07..1,253.34 rows=546 width=64) (actual rows=310 loops=1)

  • Join Filter: (staff_memberships_2.id = vacations_1.staff_membership_id)
  • Buffers: shared hit=539
91. 0.000 0.000 ↑ 1.9 54 1

Hash Join (cost=1,027.78..1,120.16 rows=100 width=32) (actual rows=54 loops=1)

  • Hash Cond: (staff_membership_activity_links_1.id = staff_activities_with_dates.link_id)
  • Buffers: shared hit=147
92. 0.000 0.000 ↑ 1.0 196 1

Hash Join (cost=58.47..149.21 rows=201 width=36) (actual rows=196 loops=1)

  • Hash Cond: (staff_membership_activity_links_1.staff_membership_id = staff_memberships_2.id)
  • Buffers: shared hit=62
93. 0.000 0.000 ↑ 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 rows=4,256 loops=1)

  • Buffers: shared hit=37
94. 0.000 0.000 ↑ 1.0 189 1

Hash (cost=56.11..56.11 rows=189 width=16) (actual rows=189 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 17kB
  • Buffers: shared hit=25
95. 0.000 0.000 ↑ 1.0 189 1

Bitmap Heap Scan on staff_memberships staff_memberships_2 (cost=5.74..56.11 rows=189 width=16) (actual rows=189 loops=1)

  • Recheck Cond: (account_id = 2)
  • Heap Blocks: exact=23
  • Buffers: shared hit=25
96. 0.000 0.000 ↑ 1.0 189 1

Bitmap Index Scan on index_staff_memberships_on_account_id (cost=0.00..5.70 rows=189 width=0) (actual rows=189 loops=1)

  • Index Cond: (account_id = 2)
  • Buffers: shared hit=2
97. 0.000 0.000 ↓ 8.7 1,592 1

Hash (cost=967.01..967.01 rows=184 width=4) (actual rows=1,592 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 72kB
  • Buffers: shared hit=85
98. 0.000 0.000 ↓ 8.7 1,592 1

HashAggregate (cost=965.17..967.01 rows=184 width=4) (actual rows=1,592 loops=1)

  • Group Key: staff_activities_with_dates.link_id
  • Buffers: shared hit=85
99. 0.000 0.000 ↓ 3.4 1,592 1

Subquery Scan on staff_activities_with_dates (cost=836.52..963.99 rows=472 width=4) (actual rows=1,592 loops=1)

  • Filter: ((CURRENT_DATE >= staff_activities_with_dates.start_date) AND (CURRENT_DATE <= staff_activities_with_dates.end_date))
  • Rows Removed by Filter: 2629
  • Buffers: shared hit=85
100. 0.000 0.000 ↑ 1.0 4,221 1

Unique (cost=836.52..879.01 rows=4,249 width=613) (actual rows=4,221 loops=1)

  • Buffers: shared hit=85
101. 0.000 0.000 ↑ 1.0 4,249 1

Sort (cost=836.52..847.14 rows=4,249 width=613) (actual rows=4,249 loops=1)

  • Sort Key: staff_memberships_3.account_id, staff_memberships_3.user_id, (COALESCE(staff_membership_activity_links_2.start_date, staff_memberships_3.joined_at)), (COALESCE(lag((staff_membership_activity_links_2.start_date - 1), 1) OVER (?), staff_memberships_3.archived_at, '3000-01-01'::date)) DESC
  • Sort Method: quicksort Memory: 524kB
  • Buffers: shared hit=85
102. 0.000 0.000 ↑ 1.0 4,249 1

WindowAgg (cost=484.85..580.45 rows=4,249 width=613) (actual rows=4,249 loops=1)

  • Buffers: shared hit=85
103. 0.000 0.000 ↑ 1.0 4,249 1

Sort (cost=484.85..495.47 rows=4,249 width=28) (actual rows=4,249 loops=1)

  • Sort Key: staff_membership_activity_links_2.staff_membership_id, staff_membership_activity_links_2.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 524kB
  • Buffers: shared hit=85
104. 0.000 0.000 ↑ 1.0 4,249 1

Hash Join (cost=138.05..228.79 rows=4,249 width=28) (actual rows=4,249 loops=1)

  • Hash Cond: (staff_membership_activity_links_2.staff_membership_id = staff_memberships_3.id)
  • Buffers: shared hit=85
105. 0.000 0.000 ↑ 1.0 4,256 1

Seq Scan on staff_membership_activity_links staff_membership_activity_links_2 (cost=0.00..79.56 rows=4,256 width=12) (actual rows=4,256 loops=1)

  • Buffers: shared hit=37
106. 0.000 0.000 ↑ 1.0 4,002 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 229kB
  • Buffers: shared hit=48
107. 0.000 0.000 ↑ 1.0 4,002 1

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

  • Buffers: shared hit=48
108. 0.000 0.000 ↑ 4.0 6 54

Index Scan using index_vacations_on_staff_membership_id on vacations vacations_1 (cost=0.29..1.03 rows=24 width=44) (actual rows=6 loops=54)

  • Index Cond: (staff_membership_id = staff_membership_activity_links_1.staff_membership_id)
  • Buffers: shared hit=392
109. 0.000 0.000 ↑ 4.2 6 310

Function Scan on generate_series generate_series_2 (cost=0.01..18.76 rows=25 width=8) (actual rows=6 loops=310)

  • Filter: (date_part('dow'::text, generate_series) = ANY ('{1,2,3,4,5}'::double precision[]))
  • Rows Removed by Filter: 2
110. 0.000 0.000 ↑ 1.1 6,213 1

Sort (cost=1,361.43..1,378.39 rows=6,783 width=16) (actual rows=6,213 loops=1)

  • Sort Key: non_working_intervals_by_dates_1.user_id, non_working_intervals_by_dates_1.date
  • Sort Method: quicksort Memory: 516kB
  • Buffers: shared hit=109
111. 0.000 0.000 ↓ 1.0 6,891 1

Bitmap Heap Scan on non_working_intervals_by_dates non_working_intervals_by_dates_1 (cost=160.98..929.77 rows=6,783 width=16) (actual rows=6,891 loops=1)

  • Recheck Cond: (account_id = 2)
  • Heap Blocks: exact=80
  • Buffers: shared hit=109
112. 0.000 0.000 ↓ 1.0 6,891 1

Bitmap Index Scan on non_working_intervals_by_dates_idx (cost=0.00..159.29 rows=6,783 width=0) (actual rows=6,891 loops=1)

  • Index Cond: (account_id = 2)
  • Buffers: shared hit=29
113. 0.000 0.000 ↓ 26,978.9 19,424,792 1

Sort (cost=103.03..104.83 rows=720 width=24) (actual rows=19,424,792 loops=1)

  • Sort Key: cost_exchange_rates.currency
  • Sort Method: quicksort Memory: 81kB
  • Buffers: shared hit=41
114. 0.000 0.000 ↑ 1.0 720 1

Bitmap Heap Scan on exchange_rates_by_months cost_exchange_rates (cost=21.86..68.86 rows=720 width=24) (actual rows=720 loops=1)

  • Recheck Cond: (account_id = 2)
  • Heap Blocks: exact=37
  • Buffers: shared hit=41
115. 0.000 0.000 ↑ 1.0 720 1

Bitmap Index Scan on exchange_rates_by_months_idx (cost=0.00..21.68 rows=720 width=0) (actual rows=720 loops=1)

  • Index Cond: (account_id = 2)
  • Buffers: shared hit=4
116. 0.000 0.000 ↓ 2.5 694,999 1

Sort (cost=46,830.92..47,512.59 rows=272,669 width=44) (actual rows=694,999 loops=1)

  • Sort Key: ""*SELECT* 1"".project_id, ""*SELECT* 1"".activity_id
  • Sort Method: quicksort Memory: 32838kB
  • Buffers: shared hit=8680
117. 0.000 0.000 ↑ 1.0 263,033 1

Append (cost=300.88..22,213.28 rows=272,669 width=44) (actual rows=263,033 loops=1)

  • Buffers: shared hit=8680
118. 0.000 0.000 ↓ 9.7 474 1

Subquery Scan on *SELECT* 1 (cost=300.88..470.62 rows=49 width=44) (actual rows=474 loops=1)

  • Buffers: shared hit=2602
119. 0.000 0.000 ↓ 9.7 474 1

Merge Join (cost=300.88..470.13 rows=49 width=612) (actual rows=474 loops=1)

  • Merge Cond: (clients_1.brand_id = brands.id)
  • Buffers: shared hit=2602
120. 0.000 0.000 ↓ 9.7 474 1

Nested Loop (cost=294.80..1,671.71 rows=49 width=52) (actual rows=474 loops=1)

  • Buffers: shared hit=2601
121. 0.000 0.000 ↓ 5.0 5 1

Merge Join (cost=294.38..294.67 rows=1 width=32) (actual rows=5 loops=1)

  • Merge Cond: (rate_cards.rateable_id = clients_1.brand_id)
  • Buffers: shared hit=144
122. 0.000 0.000 ↑ 28.8 4 1

WindowAgg (cost=108.61..111.49 rows=115 width=45) (actual rows=4 loops=1)

  • Buffers: shared hit=44
123. 0.000 0.000 ↑ 23.0 5 1

Sort (cost=108.61..108.90 rows=115 width=29) (actual rows=5 loops=1)

  • Sort Key: rate_cards.rateable_id, rate_cards.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 33kB
  • Buffers: shared hit=44
124. 0.000 0.000 ↑ 1.0 115 1

Seq Scan on rate_cards (cost=0.00..104.68 rows=115 width=29) (actual rows=115 loops=1)

  • Filter: ((rateable_type)::text = 'Brand'::text)
  • Rows Removed by Filter: 4739
  • Buffers: shared hit=44
125. 0.000 0.000 ↑ 1.0 5 1

Sort (cost=185.76..185.78 rows=5 width=8) (actual rows=5 loops=1)

  • Sort Key: clients_1.brand_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=100
126. 0.000 0.000 ↑ 1.0 5 1

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

  • Buffers: shared hit=100
127. 0.000 0.000 ↑ 1.0 5 1

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

  • Buffers: shared hit=85
128. 0.000 0.000 ↑ 1.0 5 1

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

  • Filter: ((rates_type)::text = 'brand'::text)
  • Rows Removed by Filter: 5805
  • Buffers: shared hit=70
129. 0.000 0.000 ↑ 1.0 1 5

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

  • Index Cond: (id = pricing_models.project_id)
  • Buffers: shared hit=15
130. 0.000 0.000 ↑ 1.0 1 5

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

  • Index Cond: (id = projects_2.client_id)
  • Buffers: shared hit=15
131. 0.000 0.000 ↓ 1.9 95 5

Index Scan using index_rates_on_activity_id_and_rate_card_id on rates (cost=0.42..1,376.55 rows=49 width=28) (actual rows=95 loops=5)

  • Index Cond: (rate_card_id = rate_cards.id)
  • Buffers: shared hit=2457
132. 0.000 0.000 ↑ 38.3 3 1

Sort (cost=6.09..6.37 rows=115 width=4) (actual rows=3 loops=1)

  • Sort Key: brands.id
  • Sort Method: quicksort Memory: 30kB
  • Buffers: shared hit=1
133. 0.000 0.000 ↑ 1.0 115 1

Seq Scan on brands (cost=0.00..2.15 rows=115 width=4) (actual rows=115 loops=1)

  • Buffers: shared hit=1
134. 0.000 0.000 ↓ 2.6 91,600 1

Subquery Scan on *SELECT* 2 (cost=583.00..5,484.31 rows=35,240 width=44) (actual rows=91,600 loops=1)

  • Buffers: shared hit=2036
135. 0.000 0.000 ↓ 2.6 91,600 1

Hash Join (cost=583.00..5,131.91 rows=35,240 width=612) (actual rows=91,600 loops=1)

  • Hash Cond: (rates_1.rate_card_id = rate_cards_1.id)
  • Buffers: shared hit=2036
136. 0.000 0.000 ↑ 1.0 174,437 1

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

  • Buffers: shared hit=1798
137. 0.000 0.000 ↑ 1.1 657 1

Hash (cost=574.00..574.00 rows=720 width=24) (actual rows=657 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 47kB
  • Buffers: shared hit=238
138. 0.000 0.000 ↑ 1.1 657 1

Hash Join (cost=378.98..574.00 rows=720 width=24) (actual rows=657 loops=1)

  • Hash Cond: (clients_2.office_id = offices.id)
  • Buffers: shared hit=238
139. 0.000 0.000 ↑ 1.0 623 1

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

  • Hash Cond: (projects_3.client_id = clients_2.id)
  • Buffers: shared hit=190
140. 0.000 0.000 ↑ 1.0 623 1

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

  • Hash Cond: (projects_3.id = pricing_models_1.project_id)
  • Buffers: shared hit=168
141. 0.000 0.000 ↑ 1.0 5,812 1

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

  • Buffers: shared hit=98
142. 0.000 0.000 ↑ 1.0 623 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 30kB
  • Buffers: shared hit=70
143. 0.000 0.000 ↑ 1.0 623 1

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

  • Filter: ((rates_type)::text = 'office'::text)
  • Rows Removed by Filter: 5187
  • Buffers: shared hit=70
144. 0.000 0.000 ↑ 1.0 1,849 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 89kB
  • Buffers: shared hit=22
145. 0.000 0.000 ↑ 1.0 1,849 1

Seq Scan on clients clients_2 (cost=0.00..40.49 rows=1,849 width=8) (actual rows=1,849 loops=1)

  • Buffers: shared hit=22
146. 0.000 0.000 ↑ 1.1 450 1

Hash (cost=158.85..158.85 rows=489 width=28) (actual rows=450 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 35kB
  • Buffers: shared hit=48
147. 0.000 0.000 ↑ 1.1 450 1

Hash Join (cost=140.44..158.85 rows=489 width=28) (actual rows=450 loops=1)

  • Hash Cond: (rate_cards_1.rateable_id = offices.id)
  • Buffers: shared hit=48
148. 0.000 0.000 ↑ 1.0 489 1

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

  • Buffers: shared hit=44
149. 0.000 0.000 ↑ 1.0 489 1

Sort (cost=126.52..127.74 rows=489 width=29) (actual rows=489 loops=1)

  • Sort Key: rate_cards_1.rateable_id, rate_cards_1.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 63kB
  • Buffers: shared hit=44
150. 0.000 0.000 ↑ 1.0 489 1

Seq Scan on rate_cards rate_cards_1 (cost=0.00..104.68 rows=489 width=29) (actual rows=489 loops=1)

  • Filter: ((rateable_type)::text = 'Office'::text)
  • Rows Removed by Filter: 4365
  • Buffers: shared hit=44
151. 0.000 0.000 ↑ 1.0 441 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
  • Buffers: shared hit=4
152. 0.000 0.000 ↑ 1.0 441 1

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

  • Buffers: shared hit=4
153. 0.000 0.000 ↑ 2.2 94,593 1

Subquery Scan on *SELECT* 3 (cost=840.78..9,363.71 rows=205,419 width=44) (actual rows=94,593 loops=1)

  • Buffers: shared hit=2032
154. 0.000 0.000 ↑ 2.2 94,593 1

Hash Join (cost=840.78..7,309.52 rows=205,419 width=612) (actual rows=94,593 loops=1)

  • Hash Cond: (rates_2.rate_card_id = rate_cards_2.id)
  • Buffers: shared hit=2032
155. 0.000 0.000 ↑ 1.0 174,437 1

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

  • Buffers: shared hit=1798
156. 0.000 0.000 ↑ 1.0 4,004 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 299kB
  • Buffers: shared hit=234
157. 0.000 0.000 ↑ 1.0 4,004 1

Hash Join (cost=586.95..788.31 rows=4,197 width=24) (actual rows=4,004 loops=1)

  • Hash Cond: (projects_4.client_id = clients_3.id)
  • Buffers: shared hit=234
158. 0.000 0.000 ↑ 1.0 3,620 1

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

  • Hash Cond: (pricing_models_2.project_id = projects_4.id)
  • Buffers: shared hit=168
159. 0.000 0.000 ↑ 1.0 3,621 1

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

  • Filter: ((rates_type)::text = 'client'::text)
  • Rows Removed by Filter: 2189
  • Buffers: shared hit=70
160. 0.000 0.000 ↑ 1.0 5,812 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 292kB
  • Buffers: shared hit=98
161. 0.000 0.000 ↑ 1.0 5,812 1

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

  • Buffers: shared hit=98
162. 0.000 0.000 ↑ 1.0 1,820 1

Hash (cost=335.42..335.42 rows=1,821 width=28) (actual rows=1,820 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 123kB
  • Buffers: shared hit=66
163. 0.000 0.000 ↑ 1.0 1,820 1

Hash Join (cost=266.89..335.42 rows=1,821 width=28) (actual rows=1,820 loops=1)