explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HRXc

Settings
# exclusive inclusive rows x rows loops node
1. 5,304.851 35,830.888 ↓ 5.3 638,535 1

Merge Left Join (cost=2,120,290.88..2,123,202.45 rows=120,241 width=140) (actual time=28,410.199..35,830.888 rows=638,535 loops=1)

  • Merge Cond: ((projects.account_id = cost_exchange_rates.account_id) AND ((sa.currency)::text = (cost_exchange_rates.currency)::text))
  • Join Filter: ((cost_exchange_rates.start_date <= "*SELECT* 1_1".date) AND (cost_exchange_rates.end_date >= "*SELECT* 1_1".date))
  • Rows Removed by Join Filter: 34221967
2. 491.990 28,451.369 ↓ 5.3 638,535 1

Sort (cost=2,120,046.02..2,120,346.62 rows=120,241 width=176) (actual time=28,408.872..28,451.369 rows=638,535 loops=1)

  • Sort Key: projects.account_id, sa.currency
  • Sort Method: quicksort Memory: 184853kB
3. 5,914.588 27,959.379 ↓ 5.3 638,535 1

Merge Left Join (cost=2,108,792.39..2,109,900.34 rows=120,241 width=176) (actual time=19,672.276..27,959.379 rows=638,535 loops=1)

  • Merge Cond: ((projects.account_id = exchange_rates_by_months.account_id) AND (("*SELECT* 1".currency)::text = (exchange_rates_by_months.currency)::text))
  • Join Filter: ((exchange_rates_by_months.start_date <= "*SELECT* 1_1".date) AND (exchange_rates_by_months.end_date >= "*SELECT* 1_1".date))
  • Rows Removed by Join Filter: 38541529
4. 492.995 19,713.764 ↓ 5.3 638,535 1

Sort (cost=2,108,547.52..2,108,848.13 rows=120,241 width=168) (actual time=19,669.216..19,713.764 rows=638,535 loops=1)

  • Sort Key: projects.account_id, ""*SELECT* 1"".currency
  • Sort Method: quicksort Memory: 159598kB
5. 214.830 19,220.769 ↓ 5.3 638,535 1

Merge Left Join (cost=2,067,295.63..2,098,401.85 rows=120,241 width=168) (actual time=18,381.120..19,220.769 rows=638,535 loops=1)

  • Merge Cond: (projects.id = discounts.project_id)
  • Join Filter: (("*SELECT* 1_1".date >= discounts.start_date) AND ("*SELECT* 1_1".date <= discounts.end_date) AND (((discounts.discountable_id = "*SELECT* 1_1".user_id) AND ((discounts.discountable_type)::text = 'User'::text)) OR ((discounts.discountable_id = "*SELECT* 1_1".epic_id) AND ((discounts.discountable_type)::text = 'Epic'::text))))
  • Rows Removed by Join Filter: 599801
6. 414.273 18,967.052 ↓ 5.3 638,460 1

Merge Join (cost=2,067,272.86..2,092,559.41 rows=120,241 width=164) (actual time=18,380.824..18,967.052 rows=638,460 loops=1)

  • Merge 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: 229908
7. 677.767 17,909.054 ↓ 5.2 821,415 1

Sort (cost=2,020,441.95..2,020,834.90 rows=157,180 width=136) (actual time=17,817.271..17,909.054 rows=821,415 loops=1)

  • Sort Key: projects.id, (COALESCE(""*SELECT* 1_1"".activity_id, sa.activity_id))
  • Sort Method: quicksort Memory: 144101kB
8. 239.881 17,231.287 ↓ 5.4 849,952 1

Hash Join (cost=1,132,107.56..2,006,875.70 rows=157,180 width=136) (actual time=1,884.797..17,231.287 rows=849,952 loops=1)

  • Hash Cond: (projects.account_id = accounts.id)
9. 131.068 16,991.075 ↓ 2.4 1,116,116 1

Append (cost=1,132,088.89..2,000,889.02 rows=471,540 width=136) (actual time=1,884.373..16,991.075 rows=1,116,116 loops=1)

10. 520.461 16,618.124 ↓ 2.7 1,087,210 1

Hash Join (cost=1,132,088.89..1,557,773.60 rows=403,983 width=108) (actual time=1,884.372..16,618.124 rows=1,087,210 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
11. 420.175 16,097.525 ↑ 1.1 1,100,806 1

Hash Left Join (cost=1,132,069.92..1,539,437.01 rows=1,199,950 width=144) (actual time=1,884.167..16,097.525 rows=1,100,806 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: 258899
12. 290.894 15,664.513 ↑ 1.1 1,100,806 1

Hash Join (cost=1,131,915.40..1,438,239.63 rows=1,199,950 width=120) (actual time=1,871.283..15,664.513 rows=1,100,806 loops=1)

  • Hash Cond: ("*SELECT* 1_1".project_id = projects.id)
13. 130.605 15,366.538 ↑ 1.1 1,100,806 1

Append (cost=1,131,686.63..1,422,859.20 rows=1,199,950 width=116) (actual time=1,863.402..15,366.538 rows=1,100,806 loops=1)

14. 121.574 2,616.871 ↑ 1.2 396,845 1

Result (cost=1,131,686.63..1,226,655.23 rows=495,989 width=116) (actual time=1,863.401..2,616.871 rows=396,845 loops=1)

15. 44.164 2,495.297 ↑ 1.2 396,845 1

Append (cost=1,131,686.63..1,220,455.37 rows=495,989 width=140) (actual time=1,863.397..2,495.297 rows=396,845 loops=1)

16. 58.516 2,160.608 ↑ 1.4 338,629 1

Subquery Scan on *SELECT* 1_1 (cost=1,131,686.63..1,155,495.07 rows=457,239 width=114) (actual time=1,863.396..2,160.608 rows=338,629 loops=1)

17. 91.524 2,102.092 ↑ 1.4 338,629 1

Merge Left Join (cost=1,131,686.63..1,148,636.49 rows=457,239 width=134) (actual time=1,863.394..2,102.092 rows=338,629 loops=1)

  • Merge Cond: ((projects_1.account_id = summary_vacations_by_dates.account_id) AND (generate_series.generate_series = summary_vacations_by_dates.date) AND (plan_rows.user_id = summary_vacations_by_dates.user_id))
18. 104.026 1,878.815 ↑ 1.4 338,629 1

Merge Anti Join (cost=525,089.35..531,687.96 rows=457,239 width=66) (actual time=1,736.874..1,878.815 rows=338,629 loops=1)

  • Merge Cond: ((projects_1.account_id = non_working_intervals_by_dates.account_id) AND (generate_series.generate_series = non_working_intervals_by_dates.date) AND (plan_rows.user_id = non_working_intervals_by_dates.user_id))
19. 902.033 1,718.131 ↑ 1.7 346,275 1

Sort (cost=519,071.36..520,519.29 rows=579,175 width=66) (actual time=1,684.408..1,718.131 rows=346,275 loops=1)

  • Sort Key: projects_1.account_id, generate_series.generate_series, plan_rows.user_id
  • Sort Method: quicksort Memory: 60983kB
20. 140.114 816.098 ↑ 1.7 346,275 1

Merge Left Join (cost=12,929.64..463,633.77 rows=579,175 width=66) (actual time=345.476..816.098 rows=346,275 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: 3247
21. 63.648 379.629 ↑ 1.7 346,275 1

Nested Loop (cost=3,971.09..448,257.03 rows=579,175 width=70) (actual time=76.620..379.629 rows=346,275 loops=1)

22. 14.405 125.147 ↓ 1.2 27,262 1

Merge Join (cost=3,971.09..8,084.02 rows=23,167 width=70) (actual time=76.589..125.147 rows=27,262 loops=1)

  • Merge Cond: (plan_rows.uuid = plan_items.plan_row_uuid)
23. 29.569 29.569 ↑ 1.0 42,344 1

Index Scan using plan_rows_uuid_key on plan_rows (cost=0.29..3,663.60 rows=42,428 width=28) (actual time=0.010..29.569 rows=42,344 loops=1)

  • Filter: (user_id IS NOT NULL)
  • Rows Removed by Filter: 5762
24. 19.996 81.173 ↓ 1.1 29,797 1

Sort (cost=3,970.18..4,035.85 rows=26,267 width=58) (actual time=76.475..81.173 rows=29,797 loops=1)

  • Sort Key: plan_items.plan_row_uuid
  • Sort Method: quicksort Memory: 4959kB
25. 7.906 61.177 ↓ 1.1 29,797 1

Hash Join (cost=430.80..2,042.06 rows=26,267 width=58) (actual time=8.773..61.177 rows=29,797 loops=1)

  • Hash Cond: (project_plans.project_id = projects_1.id)
26. 12.800 51.331 ↓ 1.1 29,797 1

Hash Join (cost=202.03..1,744.28 rows=26,267 width=54) (actual time=6.799..51.331 rows=29,797 loops=1)

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

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

  • Filter: (utilization > '0'::numeric)
  • Rows Removed by Filter: 264
28. 0.513 6.748 ↑ 1.0 2,851 1

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

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

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

  • Filter: active
  • Rows Removed by Filter: 3188
30. 0.999 1.940 ↑ 1.0 5,812 1

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

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

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

32. 190.834 190.834 ↑ 1.9 13 27,262

Function Scan on generate_series (cost=0.01..18.76 rows=25 width=8) (actual time=0.003..0.007 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
33. 45.948 296.355 ↓ 77.4 384,529 1

Sort (cost=8,958.54..8,970.97 rows=4,971 width=36) (actual time=268.845..296.355 rows=384,529 loops=1)

  • Sort Key: pa.plan_row_uuid
  • Sort Method: quicksort Memory: 5007kB
34. 6.099 250.407 ↓ 8.9 44,428 1

Subquery Scan on pa (cost=8,529.07..8,653.34 rows=4,971 width=36) (actual time=203.853..250.407 rows=44,428 loops=1)

35. 76.585 244.308 ↓ 8.9 44,428 1

HashAggregate (cost=8,529.07..8,603.63 rows=4,971 width=48) (actual time=203.852..244.308 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)
36. 65.742 167.723 ↑ 1.0 44,581 1

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

37. 28.314 101.981 ↑ 1.0 44,581 1

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

  • Sort Key: plan_roles.plan_row_uuid, plan_roles.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 5023kB
38. 18.315 73.667 ↑ 1.0 44,581 1

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

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

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

40. 11.896 33.229 ↑ 1.0 48,106 1

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

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

42. 33.492 56.658 ↑ 1.0 59,679 1

Sort (cost=6,017.99..6,167.27 rows=59,712 width=12) (actual time=52.459..56.658 rows=59,679 loops=1)

  • Sort Key: non_working_intervals_by_dates.account_id, non_working_intervals_by_dates.date, non_working_intervals_by_dates.user_id
  • Sort Method: quicksort Memory: 4336kB
43. 23.166 23.166 ↑ 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.028..23.166 rows=59,712 loops=1)

44. 37.968 131.753 ↑ 15.5 37,180 1

Sort (cost=606,597.28..608,034.78 rows=575,000 width=44) (actual time=126.514..131.753 rows=37,180 loops=1)

  • Sort Key: summary_vacations_by_dates.account_id, summary_vacations_by_dates.date, summary_vacations_by_dates.user_id
  • Sort Method: quicksort Memory: 2844kB
45. 4.220 93.785 ↑ 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=73.376..93.785 rows=32,266 loops=1)

46. 32.517 89.565 ↑ 17.8 32,266 1

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

  • Group Key: generate_series_1.generate_series, staff_memberships.user_id, staff_memberships.account_id
47. 11.280 57.048 ↑ 134.2 32,422 1

Hash Join (cost=138.05..493,700.50 rows=4,351,382 width=21) (actual time=2.099..57.048 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
48. 11.466 43.725 ↑ 634.8 34,330 1

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

49. 10.467 10.467 ↑ 1.0 21,792 1

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

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

51. 0.796 2.043 ↑ 1.0 4,002 1

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

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

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

53. 35.097 290.525 ↓ 1.5 58,216 1

Hash Join (cost=1,215.85..62,092.86 rows=38,750 width=114) (actual time=8.077..290.525 rows=58,216 loops=1)

  • Hash Cond: (project_plans_1.project_id = projects_1_1.id)
  • Join Filter: (NOT (SubPlan 1))
  • Rows Removed by Join Filter: 770
54. 11.392 76.343 ↑ 1.3 58,986 1

Nested Loop (cost=987.08..61,446.50 rows=77,500 width=58) (actual time=5.865..76.343 rows=58,986 loops=1)

55. 1.475 26.926 ↑ 1.2 2,535 1

Hash Join (cost=987.08..2,546.49 rows=3,100 width=58) (actual time=5.842..26.926 rows=2,535 loops=1)

  • Hash Cond: (plan_items_1.project_plan_id = project_plans_1.id)
56. 10.654 23.968 ↓ 1.2 7,876 1

Hash Join (cost=785.05..2,327.21 rows=6,567 width=54) (actual time=4.309..23.968 rows=7,876 loops=1)

  • Hash Cond: (plan_items_1.plan_row_uuid = plan_rows_2.uuid)
57. 9.126 9.126 ↓ 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.009..9.126 rows=55,664 loops=1)

  • Filter: (utilization > '0'::numeric)
  • Rows Removed by Filter: 264
58. 1.133 4.188 ↓ 1.0 5,762 1

Hash (cost=714.07..714.07 rows=5,678 width=24) (actual time=4.188..4.188 rows=5,762 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 366kB
59. 1.392 3.055 ↓ 1.0 5,762 1

Bitmap Heap Scan on plan_rows plan_rows_2 (cost=108.29..714.07 rows=5,678 width=24) (actual time=1.723..3.055 rows=5,762 loops=1)

  • Recheck Cond: (user_id IS NULL)
  • Heap Blocks: exact=430
60. 1.663 1.663 ↓ 1.0 5,762 1

Bitmap Index Scan on index_plan_rows_on_user_id (cost=0.00..106.88 rows=5,678 width=0) (actual time=1.663..1.663 rows=5,762 loops=1)

  • Index Cond: (user_id IS NULL)
61. 0.426 1.483 ↑ 1.0 2,851 1

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

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

  • Filter: active
  • Rows Removed by Filter: 3188
63. 38.025 38.025 ↑ 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.005..0.015 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
64. 0.966 2.127 ↑ 1.0 5,812 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 314kB
65. 1.161 1.161 ↑ 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.013..1.161 rows=5,812 loops=1)

66.          

SubPlan (for Hash Join)

67. 58.986 176.958 ↓ 0.0 0 58,986

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

68. 58.986 58.986 ↑ 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.001..0.001 rows=1 loops=58,986)

  • Index Cond: (projects_1_1.client_id = id)
69. 58.986 58.986 ↓ 0.0 0 58,986

Index Only Scan using non_working_intervals_by_office_id_idx on non_working_intervals_by_dates non_working_intervals_by_dates_2 (cost=0.41..8.44 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=58,986)

  • Index Cond: ((account_id = projects_1_1.account_id) AND (office_id = clients_3.office_id) AND (date = generate_series_2.generate_series))
  • Heap Fetches: 770
70. 11,649.174 12,619.062 ↑ 1.0 703,961 1

Hash Right Join (cost=45,029.23..183,164.61 rows=703,961 width=116) (actual time=910.487..12,619.062 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: 63215381
71. 89.845 179.954 ↓ 8.9 44,428 1

HashAggregate (cost=8,529.07..8,603.63 rows=4,971 width=48) (actual time=117.486..179.954 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)
72. 28.867 90.109 ↑ 1.0 44,581 1

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

73. 22.776 61.242 ↑ 1.0 44,581 1

Sort (cost=6,077.00..6,188.46 rows=44,583 width=52) (actual time=55.885..61.242 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
74. 15.064 38.466 ↑ 1.0 44,581 1

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

  • Hash Cond: (plan_roles_1.plan_row_uuid = plan_rows_3.uuid)
75. 3.967 3.967 ↑ 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.010..3.967 rows=44,581 loops=1)

76. 11.168 19.435 ↑ 1.0 48,106 1

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

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

78. 199.300 789.934 ↑ 1.0 703,961 1

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

  • Buckets: 1048576 Batches: 1 Memory Usage: 62366kB
79. 254.117 590.634 ↑ 1.0 703,961 1

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

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

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

81. 5.617 27.109 ↑ 1.0 26,435 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 1381kB
82. 7.435 21.492 ↑ 1.0 26,435 1

Hash Left Join (cost=202.03..1,496.14 rows=26,435 width=16) (actual time=1.508..21.492 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
83. 12.592 12.592 ↑ 1.0 26,435 1

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

84. 0.445 1.465 ↑ 1.0 2,851 1

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

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

  • Filter: active
  • Rows Removed by Filter: 3188
86. 1.134 7.081 ↑ 1.0 5,812 1

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

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

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

88. 1.303 12.837 ↑ 1.0 4,221 1

Hash (cost=91.21..91.21 rows=4,221 width=40) (actual time=12.837..12.837 rows=4,221 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 370kB
89. 11.534 11.534 ↑ 1.0 4,221 1

Seq Scan on staff_activities_with_dates sa (cost=0.00..91.21 rows=4,221 width=40) (actual time=0.021..11.534 rows=4,221 loops=1)

90. 0.056 0.138 ↑ 1.0 354 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
91. 0.082 0.082 ↑ 1.0 354 1

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

92. 9.226 241.883 ↑ 2.3 28,906 1

Subquery Scan on *SELECT* 2_1 (cost=2,320.78..436,717.88 rows=67,557 width=136) (actual time=22.951..241.883 rows=28,906 loops=1)

93. 147.308 232.657 ↑ 2.3 28,906 1

Hash Anti Join (cost=2,320.78..435,873.42 rows=67,557 width=143) (actual time=22.949..232.657 rows=28,906 loops=1)

  • Hash Cond: ((sa_1.account_id = non_working_intervals_by_dates_1.account_id) AND (sa_1.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
94. 15.258 64.400 ↑ 2.6 29,394 1

Hash Join (cost=143.98..429,184.39 rows=77,078 width=64) (actual time=1.940..64.400 rows=29,394 loops=1)

  • Hash Cond: (vacations_1.staff_membership_id = sa_1.staff_membership_id)
  • Join Filter: ((generate_series_3.generate_series >= sa_1.start_date) AND (generate_series_3.generate_series <= sa_1.end_date))
  • Rows Removed by Join Filter: 10924
95. 22.991 47.273 ↑ 17.5 31,132 1

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

96. 2.490 2.490 ↑ 1.0 21,792 1

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

97. 21.792 21.792 ↑ 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.001 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
98. 1.042 1.869 ↑ 1.0 4,221 1

Hash (cost=91.21..91.21 rows=4,221 width=36) (actual time=1.869..1.869 rows=4,221 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 350kB
99. 0.827 0.827 ↑ 1.0 4,221 1

Seq Scan on staff_activities_with_dates sa_1 (cost=0.00..91.21 rows=4,221 width=36) (actual time=0.006..0.827 rows=4,221 loops=1)

100. 11.061 20.949 ↑ 1.0 58,975 1

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

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

102. 0.023 0.331 ↑ 9.8 12 1

Hash (cost=17.20..17.20 rows=118 width=4) (actual time=0.331..0.331 rows=12 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
103. 0.308 0.308 ↑ 9.8 12 1

Seq Scan on accounts (cost=0.00..17.20 rows=118 width=4) (actual time=0.018..0.308 rows=12 loops=1)

  • Filter: ((suspended_at)::date >= CURRENT_DATE)
  • Rows Removed by Filter: 342
104. 335.644 643.725 ↓ 4.1 1,115,238 1

Sort (cost=46,830.92..47,512.59 rows=272,669 width=44) (actual time=563.276..643.725 rows=1,115,238 loops=1)

  • Sort Key: ""*SELECT* 1"".project_id, ""*SELECT* 1"".activity_id
  • Sort Method: quicksort Memory: 32838kB
105. 27.923 308.081 ↑ 1.0 263,033 1

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

106. 0.094 32.531 ↓ 9.7 474 1

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

107. 0.151 32.437 ↓ 9.7 474 1

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

  • Merge Cond: (clients.brand_id = brands.id)
108. 0.163 31.582 ↓ 9.7 474 1

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

109. 0.010 6.389 ↓ 5.0 5 1

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

  • Merge Cond: (rate_cards.rateable_id = clients.brand_id)
110. 0.032 3.767 ↑ 28.8 4 1

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

111. 0.093 3.735 ↑ 23.0 5 1

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

  • Sort Key: rate_cards.rateable_id, rate_cards.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 33kB
112. 3.642 3.642 ↑ 1.0 115 1

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

  • Filter: ((rateable_type)::text = 'Brand'::text)
  • Rows Removed by Filter: 4739
113. 0.045 2.612 ↑ 1.0 5 1

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

  • Sort Key: clients.brand_id
  • Sort Method: quicksort Memory: 25kB
114. 0.007 2.567 ↑ 1.0 5 1

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

115. 0.015 2.530 ↑ 1.0 5 1

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

116. 2.450 2.450 ↑ 1.0 5 1

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

  • Filter: ((rates_type)::text = 'brand'::text)
  • Rows Removed by Filter: 5805
117. 0.065 0.065 ↑ 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.013..0.013 rows=1 loops=5)

  • Index Cond: (id = pricing_models.project_id)
118. 0.030 0.030 ↑ 1.0 1 5

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

  • Index Cond: (id = projects_2.client_id)
119. 25.030 25.030 ↓ 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 time=1.193..5.006 rows=95 loops=5)

  • Index Cond: (rate_card_id = rate_cards.id)
120. 0.664 0.704 ↑ 38.3 3 1

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

  • Sort Key: brands.id
  • Sort Method: quicksort Memory: 30kB
121. 0.040 0.040 ↑ 1.0 115 1

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

122. 12.573 103.480 ↓ 2.6 91,600 1

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

123. 36.246 90.907 ↓ 2.6 91,600 1

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

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

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

125. 0.157 4.866 ↑ 1.1 657 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 47kB
126. 0.171 4.709 ↑ 1.1 657 1

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

  • Hash Cond: (clients_1.office_id = offices.id)
127. 0.167 3.034 ↑ 1.0 623 1

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

  • Hash Cond: (projects_3.client_id = clients_1.id)
128. 0.827 2.232 ↑ 1.0 623 1

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

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

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

130. 0.099 0.811 ↑ 1.0 623 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 30kB
131. 0.712 0.712 ↑ 1.0 623 1

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

  • Filter: ((rates_type)::text = 'office'::text)
  • Rows Removed by Filter: 5187
132. 0.300 0.635 ↑ 1.0 1,849 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 89kB
133. 0.335 0.335 ↑ 1.0 1,849 1

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

134. 0.110 1.504 ↑ 1.1 450 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 35kB
135. 0.126 1.394 ↑ 1.1 450 1

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

  • Hash Cond: (rate_cards_1.rateable_id = offices.id)
136. 0.330 1.091 ↑ 1.0 489 1

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

137. 0.191 0.761 ↑ 1.0 489 1

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

  • Sort Key: rate_cards_1.rateable_id, rate_cards_1.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 63kB
138. 0.570 0.570 ↑ 1.0 489 1

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

  • Filter: ((rateable_type)::text = 'Office'::text)
  • Rows Removed by Filter: 4365
139. 0.079 0.177 ↑ 1.0 441 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
140. 0.098 0.098 ↑ 1.0 441 1

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

141. 13.009 75.816 ↑ 2.2 94,593 1

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

142. 36.795 62.807 ↑ 2.2 94,593 1

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

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

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

144. 0.880 10.043 ↑ 1.0 4,004 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 299kB
145. 0.966 9.163 ↑ 1.0 4,004 1

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

  • Hash Cond: (projects_4.client_id = clients_2.id)
146. 1.019 4.285 ↑ 1.0 3,620 1

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

  • Hash Cond: (pricing_models_2.project_id = projects_4.id)
147. 0.896 0.896 ↑ 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..0.896 rows=3,621 loops=1)

  • Filter: ((rates_type)::text = 'client'::text)
  • Rows Removed by Filter: 2189
148. 1.004 2.370 ↑ 1.0 5,812 1

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

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

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

150. 0.415 3.912 ↑ 1.0 1,820 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 123kB
151. 0.449 3.497 ↑ 1.0 1,820 1

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

  • Hash Cond: (rate_cards_2.rateable_id = clients_2.id)
152. 1.188 2.489 ↑ 1.0 1,821 1

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

153. 0.656 1.301 ↑ 1.0 1,821 1

Sort (cost=203.29..207.84 rows=1,821 width=29) (actual time=1.173..1.301 rows=1,821 loops=1)

  • Sort Key: rate_cards_2.rateable_id, rate_cards_2.start_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 191kB
154. 0.645 0.645 ↑ 1.0 1,821 1

Seq Scan on rate_cards rate_cards_2 (cost=0.00..104.68 rows=1,821 width=29) (actual time=0.008..0.645 rows=1,821 loops=1)

  • Filter: ((rateable_type)::text = 'Client'::text)
  • Rows Removed by Filter: 3033
155. 0.305 0.559 ↑ 1.0 1,849 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
156. 0.254 0.254 ↑ 1.0 1,849 1

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

157. 10.848 68.331 ↓ 2.4 76,366 1

Subquery Scan on *SELECT* 4 (cost=695.56..5,531.29 rows=31,961 width=44) (actual time=7.898..68.331 rows=76,366 loops=1)

158. 33.842 57.483 ↓ 2.4 76,366 1

Hash Join (cost=695.56..5,211.68 rows=31,961 width=612) (actual time=7.897..57.483 rows=76,366 loops=1)

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

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

160. 0.351 7.866 ↓ 2.4 1,591 1

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

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 110kB
161. 0.925 7.515 ↓ 2.4 1,591 1

Hash Join (cost=502.95..687.40 rows=653 width=24) (actual time=6.041..7.515 rows=1,591 loops=1)

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

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

163. 0.350 5.984 ↓ 2.4 1,591 1

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

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 110kB
164. 1.413 5.634 ↓ 2.4 1,591 1

Hash Join (cost=403.40..494.79 rows=653 width=24) (actual time=3.552..5.634 rows=1,591 loops=1)

  • Hash Cond: (rate_cards_3.rateable_id = pricing_models_3.id)
165. 1.484 3.206 ↑ 1.0 2,429 1

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

166. 1.050 1.722 ↑ 1.0 2,429 1

Sort (cost=241.26..247.33 rows=2,429 width=29) (actual time=1.558..1.722 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
167. 0.672 0.672 ↑ 1.0 2,429 1

Seq Scan on rate_cards rate_cards_3 (cost=0.00..104.68 rows=2,429 width=29) (actual time=0.007..0.672 rows=2,429 loops=1)

  • Filter: ((rateable_type)::text = 'PricingModel'::text)
  • Rows Removed by Filter: 2425
168. 0.244 1.015 ↑ 1.0 1,561 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 77kB
169. 0.771 0.771 ↑ 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.020..0.771 rows=1,561 loops=1)

  • Filter: ((rates_type)::text = 'custom'::text)
  • Rows Removed by Filter: 4249
170. 38.742 38.887 ↓ 1,993.3 609,953 1

Sort (cost=22.77..23.53 rows=306 width=26) (actual time=0.293..38.887 rows=609,953 loops=1)

  • Sort Key: discounts.project_id
  • Sort Method: quicksort Memory: 53kB
171. 0.145 0.145 ↓ 1.2 359 1

Seq Scan on discounts (cost=0.00..10.13 rows=306 width=26) (actual time=0.030..0.145 rows=359 loops=1)

  • Filter: (((discountable_type)::text = 'User'::text) OR ((discountable_type)::text = 'Epic'::text))
  • Rows Removed by Filter: 50
172. 2,330.082 2,331.027 ↓ 12,841.5 39,140,740 1

Sort (cost=244.86..252.48 rows=3,048 width=24) (actual time=2.978..2,331.027 rows=39,140,740 loops=1)

  • Sort Key: exchange_rates_by_months.account_id, exchange_rates_by_months.currency
  • Sort Method: quicksort Memory: 335kB
173. 0.945 0.945 ↑ 1.0 3,048 1

Seq Scan on exchange_rates_by_months (cost=0.00..68.48 rows=3,048 width=24) (actual time=0.031..0.945 rows=3,048 loops=1)

174. 2,074.147 2,074.668 ↓ 11,405.1 34,762,629 1

Sort (cost=244.86..252.48 rows=3,048 width=24) (actual time=1.199..2,074.668 rows=34,762,629 loops=1)

  • Sort Key: cost_exchange_rates.account_id, cost_exchange_rates.currency
  • Sort Method: quicksort Memory: 335kB
175. 0.521 0.521 ↑ 1.0 3,048 1

Seq Scan on exchange_rates_by_months cost_exchange_rates (cost=0.00..68.48 rows=3,048 width=24) (actual time=0.015..0.521 rows=3,048 loops=1)

Planning time : 33.273 ms
Execution time : 35,979.752 ms