explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jUws

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 775.046 ↑ 4.0 1 1

Subquery Scan on report_items_live (cost=1,266,562.77..1,266,563.15 rows=4 width=140) (actual time=775.046..775.046 rows=1 loops=1)

  • Buffers: shared hit=10211, temp read=346 written=347
2. 0.010 775.044 ↑ 4.0 1 1

GroupAggregate (cost=1,266,562.77..1,266,563.11 rows=4 width=196) (actual time=775.044..775.044 rows=1 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=10211, temp read=346 written=347
3. 0.021 775.034 ↑ 4.0 1 1

Sort (cost=1,266,562.77..1,266,562.78 rows=4 width=192) (actual time=775.034..775.034 rows=1 loops=1)

  • Sort 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.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: 25kB
  • Buffers: shared hit=10211, temp read=346 written=347
4. 0.009 775.013 ↑ 4.0 1 1

Hash Join (cost=1,162,539.15..1,266,562.73 rows=4 width=192) (actual time=547.588..775.013 rows=1 loops=1)

  • Hash Cond: (items.account_id = accounts.id)
  • Buffers: shared hit=10211, temp read=346 written=347
5. 0.007 774.793 ↑ 4.0 1 1

Nested Loop Left Join (cost=1,162,520.48..1,266,544.04 rows=4 width=184) (actual time=547.369..774.793 rows=1 loops=1)

  • Buffers: shared hit=10200, temp read=346 written=347
6. 0.007 774.772 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,162,516.03..1,266,527.36 rows=1 width=692) (actual time=547.349..774.772 rows=1 loops=1)

  • Buffers: shared hit=10197, temp read=346 written=347
7. 0.018 774.749 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,162,511.59..1,266,510.69 rows=1 width=684) (actual time=547.327..774.749 rows=1 loops=1)

  • Buffers: shared hit=10194, temp read=346 written=347
8. 35.659 774.644 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,162,507.14..1,266,494.02 rows=1 width=676) (actual time=547.223..774.644 rows=1 loops=1)

  • Join Filter: ((items.date >= "*SELECT* 1".start_date) AND ((items.date <= "*SELECT* 1".end_date) OR ("*SELECT* 1".end_date IS NULL)) AND ("*SELECT* 1".project_id = items.project_id) AND ("*SELECT* 1".activity_id = items.activity_id))
  • Rows Removed by Join Filter: 263032
  • Buffers: shared hit=10191, temp read=346 written=347
9. 0.012 226.663 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,162,206.26..1,238,827.36 rows=1 width=648) (actual time=221.249..226.663 rows=1 loops=1)

  • Buffers: shared hit=1511, temp read=346 written=347
10. 0.002 226.640 ↑ 1.0 1 1

Subquery Scan on items (cost=1,162,201.96..1,238,818.75 rows=1 width=644) (actual time=221.226..226.640 rows=1 loops=1)

  • Filter: (items.reportable_type = 'TimeLog'::text)
  • Buffers: shared hit=1509, temp read=346 written=347
11. 0.002 226.638 ↑ 2.0 1 1

Append (cost=1,162,201.96..1,238,818.72 rows=2 width=644) (actual time=221.225..226.638 rows=1 loops=1)

  • Buffers: shared hit=1509, temp read=346 written=347
12. 0.077 226.618 ↑ 1.0 1 1

Hash Left Join (cost=1,162,201.96..1,237,811.35 rows=1 width=103) (actual time=221.224..226.618 rows=1 loops=1)

  • Hash Cond: (items_1.project_plan_id = pa.project_plan_id)
  • Join Filter: ((items_1.date >= pa.start_date) AND (items_1.date <= pa.end_date) AND ((pa.plan_row_uuid = items_1.plan_row_uuid) OR (items_1.plan_row_uuid IS NULL)) AND ((pa.user_id = items_1.user_id) OR (items_1.user_id IS NULL)) AND ((pa.epic_id = items_1.epic_id) OR ((items_1.reportable_type = 'PlanItem'::text) AND (items_1.epic_id IS NULL)) OR ((items_1.reportable_type = 'TimeLog'::text) AND (pa.epic_id IS NULL))))
  • Rows Removed by Join Filter: 30
  • Buffers: shared hit=1507, temp read=346 written=347
13. 0.006 18.729 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,152,879.05..1,228,487.10 rows=1 width=149) (actual time=13.351..18.729 rows=1 loops=1)

  • Filter: ((items_1.vacation_hours IS NULL) OR (items_1.vacation_hours < (COALESCE(staff_membership_activity_links.capacity, accounts_1.default_capacity))::double precision))
  • Buffers: shared hit=518
14. 0.049 18.707 ↑ 2.0 1 1

Merge Left Join (cost=1,152,878.90..1,228,486.72 rows=2 width=144) (actual time=13.330..18.707 rows=1 loops=1)

  • Merge Cond: (projects.account_id = staff_memberships_1.account_id)
  • Join Filter: ((items_1.date >= (COALESCE(staff_membership_activity_links.start_date, staff_memberships_1.joined_at))) AND (items_1.date <= (COALESCE(lag((staff_membership_activity_links.start_date - 1), 1) OVER (?), staff_memberships_1.archived_at, '3000-01-01'::date))) AND (staff_memberships_1.user_id = items_1.user_id))
  • Rows Removed by Join Filter: 194
  • Buffers: shared hit=516
15. 3.748 5.793 ↑ 2.0 1 1

Nested Loop (cost=1,152,031.76..1,227,532.72 rows=2 width=120) (actual time=0.483..5.793 rows=1 loops=1)

  • Join Filter: (items_1.project_id = projects.id)
  • Rows Removed by Join Filter: 5811
  • Buffers: shared hit=431
16. 2.045 2.045 ↑ 1.0 5,812 1

Index Scan using index_projects_on_account_id on projects (cost=0.28..525.16 rows=5,812 width=8) (actual time=0.008..2.045 rows=5,812 loops=1)

  • Buffers: shared hit=417
17. 0.000 0.000 ↑ 2.0 1 5,812

Materialize (cost=1,152,031.48..1,226,833.20 rows=2 width=116) (actual time=0.000..0.000 rows=1 loops=5,812)

  • Buffers: shared hit=14
18. 0.002 0.104 ↑ 2.0 1 1

Subquery Scan on items_1 (cost=1,152,031.48..1,226,833.19 rows=2 width=116) (actual time=0.077..0.104 rows=1 loops=1)

  • Buffers: shared hit=14
19. 0.001 0.102 ↑ 2.0 1 1

Append (cost=1,152,031.48..1,226,833.17 rows=2 width=120) (actual time=0.076..0.102 rows=1 loops=1)

  • Buffers: shared hit=14
20. 0.000 0.011 ↓ 0.0 0 1

Subquery Scan on *SELECT* 1_1 (cost=1,152,031.48..1,226,816.07 rows=1 width=120) (actual time=0.011..0.011 rows=0 loops=1)

  • Buffers: shared hit=2
21. 0.000 0.011 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,152,031.48..1,226,816.05 rows=1 width=138) (actual time=0.011..0.011 rows=0 loops=1)

  • Join Filter: (nw_intervals_by_dates_roles.office_id = clients.office_id)
  • Filter: (COALESCE(non_working_intervals_by_dates.id, nw_intervals_by_dates_roles.id) IS NULL)
  • Buffers: shared hit=2
22. 0.000 0.011 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,152,031.06..1,225,138.60 rows=25 width=110) (actual time=0.011..0.011 rows=0 loops=1)

  • Join Filter: (generate_series.generate_series = non_working_intervals_by_dates.date)
  • Buffers: shared hit=2
23. 0.003 0.011 ↓ 0.0 0 1

Hash Right Join (cost=1,152,030.65..1,225,110.82 rows=25 width=106) (actual time=0.011..0.011 rows=0 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))
  • Buffers: shared hit=2
24. 0.000 0.000 ↓ 0.0 0

GroupAggregate (cost=1,151,985.56..1,215,002.83 rows=575,000 width=52) (never executed)

  • Group Key: generate_series_1.generate_series, staff_memberships.user_id, staff_memberships.account_id
25. 0.000 0.000 ↓ 0.0 0

Sort (cost=1,151,985.56..1,162,864.01 rows=4,351,382 width=21) (never executed)

  • Sort Key: generate_series_1.generate_series, staff_memberships.user_id, staff_memberships.account_id
26. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=138.05..493,700.50 rows=4,351,382 width=21) (never executed)

  • 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)))
27. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.01..436,340.93 rows=21,792,000 width=17) (never executed)

28. 0.000 0.000 ↓ 0.0 0

Seq Scan on vacations (cost=0.00..500.92 rows=21,792 width=17) (never executed)

29. 0.000 0.000 ↓ 0.0 0

Function Scan on generate_series generate_series_1 (cost=0.01..10.01 rows=1,000 width=8) (never executed)

30. 0.000 0.000 ↓ 0.0 0

Hash (cost=88.02..88.02 rows=4,002 width=20) (never executed)

31. 0.000 0.000 ↓ 0.0 0

Seq Scan on staff_memberships (cost=0.00..88.02 rows=4,002 width=20) (never executed)

32. 0.001 0.008 ↓ 0.0 0 1

Hash (cost=44.72..44.72 rows=25 width=70) (actual time=0.008..0.008 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
  • Buffers: shared hit=2
33. 0.000 0.007 ↓ 0.0 0 1

Nested Loop (cost=1.43..44.72 rows=25 width=70) (actual time=0.007..0.007 rows=0 loops=1)

  • Buffers: shared hit=2
34. 0.000 0.007 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.42..25.71 rows=1 width=70) (actual time=0.007..0.007 rows=0 loops=1)

  • Buffers: shared hit=2
35. 0.001 0.007 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.15..25.40 rows=1 width=70) (actual time=0.007..0.007 rows=0 loops=1)

  • Buffers: shared hit=2
36. 0.000 0.006 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.86..24.93 rows=1 width=62) (actual time=0.006..0.006 rows=0 loops=1)

  • Buffers: shared hit=2
37. 0.001 0.006 ↓ 0.0 0 1

Nested Loop (cost=0.58..16.63 rows=1 width=58) (actual time=0.006..0.006 rows=0 loops=1)

  • Buffers: shared hit=2
38. 0.005 0.005 ↓ 0.0 0 1

Index Scan using plan_items_pkey on plan_items (cost=0.29..8.31 rows=1 width=46) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: (id = 1245749)
  • Filter: (utilization > '0'::numeric)
  • Buffers: shared hit=2
39. 0.000 0.000 ↓ 0.0 0

Index Scan using index_plan_rows_on_uuid on plan_rows (cost=0.29..8.31 rows=1 width=28) (never executed)

  • Index Cond: (uuid = plan_items.plan_row_uuid)
  • Filter: ((user_id IS NOT NULL) OR (activity_id IS NOT NULL))
40. 0.000 0.000 ↓ 0.0 0

Index Scan using project_plans_pkey on project_plans (cost=0.28..8.30 rows=1 width=8) (never executed)

  • Index Cond: (id = plan_items.project_plan_id)
  • Filter: active
41. 0.000 0.000 ↓ 0.0 0

Index Scan using projects_pkey on projects projects_1 (cost=0.28..0.46 rows=1 width=12) (never executed)

  • Index Cond: (project_plans.project_id = id)
42. 0.000 0.000 ↓ 0.0 0

Index Scan using clients_pkey on clients (cost=0.28..0.32 rows=1 width=8) (never executed)

  • Index Cond: (projects_1.client_id = id)
43. 0.000 0.000 ↓ 0.0 0

Function Scan on generate_series (cost=0.01..18.76 rows=25 width=8) (never executed)

  • Filter: (date_part('dow'::text, generate_series) = ANY ('{1,2,3,4,5}'::double precision[]))
44. 0.000 0.000 ↓ 0.0 0

Index Scan using non_working_intervals_by_dates_idx on non_working_intervals_by_dates (cost=0.41..1.09 rows=2 width=16) (never executed)

  • Index Cond: ((projects_1.account_id = account_id) AND (user_id = plan_rows.user_id))
45. 0.000 0.000 ↓ 0.0 0

Index Scan using non_working_intervals_by_dates_idx on non_working_intervals_by_dates nw_intervals_by_dates_roles (cost=0.41..66.96 rows=11 width=16) (never executed)

  • Index Cond: ((projects_1.account_id = account_id) AND (generate_series.generate_series = date))
46. 0.004 0.090 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.99..17.08 rows=1 width=120) (actual time=0.064..0.090 rows=1 loops=1)

  • Join Filter: (epics.project_plan_id IS NULL)
  • Buffers: shared hit=12
47. 0.004 0.037 ↑ 1.0 1 1

Nested Loop (cost=0.71..16.75 rows=1 width=36) (actual time=0.037..0.037 rows=1 loops=1)

  • Buffers: shared hit=7
48. 0.008 0.008 ↑ 1.0 1 1

Index Scan using time_logs_pkey on time_logs (cost=0.42..8.44 rows=1 width=28) (actual time=0.008..0.008 rows=1 loops=1)

  • Index Cond: (id = 1245749)
  • Buffers: shared hit=4
49. 0.025 0.025 ↑ 1.0 1 1

Index Scan using epics_pkey on epics (cost=0.29..8.30 rows=1 width=12) (actual time=0.025..0.025 rows=1 loops=1)

  • Index Cond: (id = time_logs.epic_id)
  • Buffers: shared hit=3
50. 0.049 0.049 ↑ 1.0 1 1

Index Scan using index_project_plans_on_project_id on project_plans general_epic_plans (cost=0.28..0.32 rows=1 width=8) (actual time=0.023..0.049 rows=1 loops=1)

  • Index Cond: (project_id = epics.project_id)
  • Filter: active
  • Rows Removed by Filter: 3
  • Buffers: shared hit=5
51. 0.035 12.865 ↑ 21.7 196 1

Materialize (cost=847.14..942.74 rows=4,249 width=40) (actual time=12.736..12.865 rows=196 loops=1)

  • Buffers: shared hit=85
52. 0.076 12.830 ↑ 21.7 196 1

Unique (cost=847.14..889.63 rows=4,249 width=65) (actual time=12.734..12.830 rows=196 loops=1)

  • Buffers: shared hit=85
53. 2.959 12.754 ↑ 21.6 197 1

Sort (cost=847.14..857.76 rows=4,249 width=65) (actual time=12.733..12.754 rows=197 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
54. 2.906 9.795 ↑ 1.0 4,249 1

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

  • Buffers: shared hit=85
55. 2.318 6.889 ↑ 1.0 4,249 1

Sort (cost=484.85..495.47 rows=4,249 width=56) (actual time=6.547..6.889 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
56. 1.470 4.571 ↑ 1.0 4,249 1

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

  • Hash Cond: (staff_membership_activity_links.staff_membership_id = staff_memberships_1.id)
  • Buffers: shared hit=85
57. 0.806 0.806 ↑ 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.025..0.806 rows=4,256 loops=1)

  • Buffers: shared hit=37
58. 0.978 2.295 ↑ 1.0 4,002 1

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

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

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

  • Buffers: shared hit=48
60. 0.016 0.016 ↑ 1.0 1 1

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

  • Index Cond: (id = projects.account_id)
  • Buffers: shared hit=2
61. 12.010 207.812 ↓ 8.9 44,428 1

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

  • Buckets: 65536 (originally 8192) Batches: 1 (originally 1) Memory Usage: 3912kB
  • Buffers: shared hit=989, temp read=346 written=347
62. 6.539 195.802 ↓ 8.9 44,428 1

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

  • Buffers: shared hit=989, temp read=346 written=347
63. 65.162 189.263 ↓ 8.9 44,428 1

HashAggregate (cost=9,136.50..9,211.06 rows=4,971 width=48) (actual time=151.325..189.263 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, temp read=346 written=347
64. 27.662 124.101 ↑ 1.0 44,581 1

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

  • Buffers: shared hit=989, temp read=346 written=347
65. 35.720 96.439 ↑ 1.0 44,581 1

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

  • Sort Key: plan_roles.plan_row_uuid, plan_roles.start_date DESC NULLS LAST
  • Sort Method: external merge Disk: 2768kB
  • Buffers: shared hit=989, temp read=346 written=347
66. 19.201 60.719 ↑ 1.0 44,581 1

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

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

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

  • Buffers: shared hit=440
68. 12.172 30.766 ↑ 1.0 48,106 1

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

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

  • Buffers: shared hit=549
70. 0.001 0.018 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2_1 (cost=837.79..1,007.35 rows=1 width=103) (actual time=0.018..0.018 rows=0 loops=1)

  • Buffers: shared hit=2
71. 0.000 0.017 ↓ 0.0 0 1

Nested Loop Semi Join (cost=837.79..1,007.34 rows=1 width=110) (actual time=0.017..0.017 rows=0 loops=1)

  • Join Filter: (staff_membership_activity_links_1.id = staff_activities_with_dates.link_id)
  • Buffers: shared hit=2
72. 0.001 0.017 ↓ 0.0 0 1

Nested Loop (cost=1.27..37.45 rows=1 width=68) (actual time=0.017..0.017 rows=0 loops=1)

  • Buffers: shared hit=2
73. 0.016 0.016 ↓ 0.0 0 1

Index Scan using vacations_pkey on vacations vacations_1 (cost=0.29..8.30 rows=1 width=44) (actual time=0.016..0.016 rows=0 loops=1)

  • Index Cond: (id = 1245749)
  • Buffers: shared hit=2
74. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.98..29.13 rows=1 width=44) (never executed)

75. 0.000 0.000 ↓ 0.0 0

Index Scan using index_staff_membership_activity_links_on_staff_membership_id on staff_membership_activity_links staff_membership_activity_links_1 (cost=0.28..8.30 rows=1 width=20) (never executed)

  • Index Cond: (staff_membership_id = vacations_1.staff_membership_id)
76. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.70..20.82 rows=1 width=24) (never executed)

  • Join Filter: (generate_series_2.generate_series = non_working_intervals_by_dates_1.date)
  • Filter: (non_working_intervals_by_dates_1.id IS NULL)
77. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.29..19.42 rows=1 width=24) (never executed)

  • Join Filter: (vacations_1.staff_membership_id = staff_memberships_2.id)
78. 0.000 0.000 ↓ 0.0 0

Index Scan using memberships_pkey on staff_memberships staff_memberships_2 (cost=0.28..0.35 rows=1 width=16) (never executed)

  • Index Cond: (id = staff_membership_activity_links_1.staff_membership_id)
79. 0.000 0.000 ↓ 0.0 0

Function Scan on generate_series generate_series_2 (cost=0.01..18.76 rows=25 width=8) (never executed)

  • Filter: (date_part('dow'::text, generate_series) = ANY ('{1,2,3,4,5}'::double precision[]))
80. 0.000 0.000 ↓ 0.0 0

Index Scan using non_working_intervals_by_dates_idx on non_working_intervals_by_dates non_working_intervals_by_dates_1 (cost=0.41..1.37 rows=2 width=16) (never executed)

  • Index Cond: ((staff_memberships_2.account_id = account_id) AND (user_id = staff_memberships_2.user_id))
81. 0.000 0.000 ↓ 0.0 0

Subquery Scan on staff_activities_with_dates (cost=836.52..963.99 rows=472 width=4) (never executed)

  • Filter: ((CURRENT_DATE >= staff_activities_with_dates.start_date) AND (CURRENT_DATE <= staff_activities_with_dates.end_date))
82. 0.000 0.000 ↓ 0.0 0

Unique (cost=836.52..879.01 rows=4,249 width=613) (never executed)

83. 0.000 0.000 ↓ 0.0 0

Sort (cost=836.52..847.14 rows=4,249 width=613) (never executed)

  • 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
84. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=484.85..580.45 rows=4,249 width=613) (never executed)

85. 0.000 0.000 ↓ 0.0 0

Sort (cost=484.85..495.47 rows=4,249 width=28) (never executed)

  • Sort Key: staff_membership_activity_links_2.staff_membership_id, staff_membership_activity_links_2.start_date DESC NULLS LAST
86. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=138.05..228.79 rows=4,249 width=28) (never executed)

  • Hash Cond: (staff_membership_activity_links_2.staff_membership_id = staff_memberships_3.id)
87. 0.000 0.000 ↓ 0.0 0

Seq Scan on staff_membership_activity_links staff_membership_activity_links_2 (cost=0.00..79.56 rows=4,256 width=12) (never executed)

88. 0.000 0.000 ↓ 0.0 0

Hash (cost=88.02..88.02 rows=4,002 width=20) (never executed)

89. 0.000 0.000 ↓ 0.0 0

Seq Scan on staff_memberships staff_memberships_3 (cost=0.00..88.02 rows=4,002 width=20) (never executed)

90. 0.002 0.011 ↓ 0.0 0 1

Bitmap Heap Scan on discounts (cost=4.30..8.60 rows=1 width=26) (actual time=0.011..0.011 rows=0 loops=1)

  • Recheck Cond: (project_id = items.project_id)
  • Filter: ((items.date >= start_date) AND (items.date <= end_date) AND (((discountable_type)::text = 'User'::text) OR ((discountable_type)::text = 'Epic'::text)) AND (((discountable_id = items.user_id) AND ((discountable_type)::text = 'User'::text)) OR ((discountable_id = items.epic_id) AND ((discountable_type)::text = 'Epic'::text))))
  • Buffers: shared hit=2
91. 0.009 0.009 ↓ 0.0 0 1

Bitmap Index Scan on index_discounts_on_project_id (cost=0.00..4.29 rows=3 width=0) (actual time=0.009..0.009 rows=0 loops=1)

  • Index Cond: (project_id = items.project_id)
  • Buffers: shared hit=2
92. 37.278 512.322 ↑ 1.0 263,033 1

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

  • Buffers: shared hit=8680
93. 0.083 21.274 ↓ 9.7 474 1

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

  • Buffers: shared hit=2602
94. 0.116 21.191 ↓ 9.7 474 1

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

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

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

  • Buffers: shared hit=2601
96. 0.006 3.463 ↓ 5.0 5 1

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

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

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

  • Buffers: shared hit=44
98. 0.041 1.033 ↑ 23.0 5 1

Sort (cost=108.61..108.90 rows=115 width=29) (actual time=1.032..1.033 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
99. 0.992 0.992 ↑ 1.0 115 1

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

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

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

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

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

  • Buffers: shared hit=100
102. 0.007 2.294 ↑ 1.0 5 1

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

  • Buffers: shared hit=85
103. 2.242 2.242 ↑ 1.0 5 1

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

  • Filter: ((rates_type)::text = 'brand'::text)
  • Rows Removed by Filter: 5805
  • Buffers: shared hit=70
104. 0.045 0.045 ↑ 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.009..0.009 rows=1 loops=5)

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

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

  • Index Cond: (id = projects_2.client_id)
  • Buffers: shared hit=15
106. 17.430 17.430 ↓ 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.103..3.486 rows=95 loops=5)

  • Index Cond: (rate_card_id = rate_cards.id)
  • Buffers: shared hit=2457
107. 0.032 0.057 ↑ 38.3 3 1

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

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

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

  • Buffers: shared hit=1
109. 31.117 229.964 ↓ 2.6 91,600 1

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

  • Buffers: shared hit=2036
110. 140.685 198.847 ↓ 2.6 91,600 1

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

  • Hash Cond: (rates_1.rate_card_id = rate_cards_1.id)
  • Buffers: shared hit=2036
111. 52.526 52.526 ↑ 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.019..52.526 rows=174,437 loops=1)

  • Buffers: shared hit=1798
112. 0.154 5.636 ↑ 1.1 657 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 47kB
  • Buffers: shared hit=238
113. 0.168 5.482 ↑ 1.1 657 1

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

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

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

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

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

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

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

  • Buffers: shared hit=98
117. 0.100 0.792 ↑ 1.0 623 1

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

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

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

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

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

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

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

  • Buffers: shared hit=22
121. 0.110 1.378 ↑ 1.1 450 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 35kB
  • Buffers: shared hit=48
122. 0.115 1.268 ↑ 1.1 450 1

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

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

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

  • Buffers: shared hit=44
124. 0.172 0.697 ↑ 1.0 489 1

Sort (cost=126.52..127.74 rows=489 width=29) (actual time=0.665..0.697 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
125. 0.525 0.525 ↑ 1.0 489 1

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

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

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

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

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

  • Buffers: shared hit=4
128. 19.808 124.735 ↑ 2.2 94,593 1

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

  • Buffers: shared hit=2032
129. 60.713 104.927 ↑ 2.2 94,593 1

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

  • Hash Cond: (rates_2.rate_card_id = rate_cards_2.id)
  • Buffers: shared hit=2032
130. 25.421 25.421 ↑ 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.013..25.421 rows=174,437 loops=1)

  • Buffers: shared hit=1798
131. 2.038 18.793 ↑ 1.0 4,004 1

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

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

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

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

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

  • Hash Cond: (pricing_models_2.project_id = projects_4.id)
  • Buffers: shared hit=168
134. 2.396 2.396 ↑ 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.020..2.396 rows=3,621 loops=1)

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

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

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

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

  • Buffers: shared hit=98
137. 0.794 7.040 ↑ 1.0 1,820 1

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

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

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

  • Hash Cond: (rate_cards_2.rateable_id = clients_3.id)
  • Buffers: shared hit=66
139. 2.155 4.554 ↑ 1.0 1,821 1

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

  • Buffers: shared hit=44
140. 1.215 2.399 ↑ 1.0 1,821 1

Sort (cost=203.29..207.84 rows=1,821 width=29) (actual time=2.189..2.399 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
  • Buffers: shared hit=44
141. 1.184 1.184 ↑ 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.010..1.184 rows=1,821 loops=1)

  • Filter: ((rateable_type)::text = 'Client'::text)
  • Rows Removed by Filter: 3033
  • Buffers: shared hit=44
142. 0.477 0.879 ↑ 1.0 1,849 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
  • Buffers: shared hit=22
143. 0.402 0.402 ↑ 1.0 1,849 1

Seq Scan on clients clients_3 (cost=0.00..40.49 rows=1,849 width=4) (actual time=0.013..0.402 rows=1,849 loops=1)

  • Buffers: shared hit=22
144. 15.031 99.071 ↓ 2.4 76,366 1

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

  • Buffers: shared hit=2010
145. 51.303 84.040 ↓ 2.4 76,366 1

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

  • Hash Cond: (rates_3.rate_card_id = rate_cards_3.id)
  • Buffers: shared hit=2010
146. 23.767 23.767 ↑ 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.012..23.767 rows=174,437 loops=1)

  • Buffers: shared hit=1798
147. 0.446 8.970 ↓ 2.4 1,591 1

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

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 110kB
  • Buffers: shared hit=212
148. 1.150 8.524 ↓ 2.4 1,591 1

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

  • Hash Cond: (projects_5.id = pricing_models_3.project_id)
  • Buffers: shared hit=212
149. 0.738 0.738 ↑ 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.738 rows=5,812 loops=1)

  • Buffers: shared hit=98
150. 0.403 6.636 ↓ 2.4 1,591 1

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

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 110kB
  • Buffers: shared hit=114
151. 0.536 6.233 ↓ 2.4 1,591 1

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

  • Hash Cond: (rate_cards_3.rateable_id = pricing_models_3.id)
  • Buffers: shared hit=114
152. 1.619 3.498 ↑ 1.0 2,429 1

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

  • Buffers: shared hit=44
153. 1.069 1.879 ↑ 1.0 2,429 1

Sort (cost=241.26..247.33 rows=2,429 width=29) (actual time=1.692..1.879 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
  • Buffers: shared hit=44
154. 0.810 0.810 ↑ 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.013..0.810 rows=2,429 loops=1)

  • Filter: ((rateable_type)::text = 'PricingModel'::text)
  • Rows Removed by Filter: 2425
  • Buffers: shared hit=44
155. 1.334 2.199 ↑ 1.0 1,561 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 77kB
  • Buffers: shared hit=70
156. 0.865 0.865 ↑ 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.865 rows=1,561 loops=1)

  • Filter: ((rates_type)::text = 'custom'::text)
  • Rows Removed by Filter: 4249
  • Buffers: shared hit=70
157. 0.024 0.087 ↑ 4.0 1 1

Bitmap Heap Scan on exchange_rates_by_months (cost=4.45..16.63 rows=4 width=24) (actual time=0.087..0.087 rows=1 loops=1)

  • Recheck Cond: ((account_id = items.account_id) AND ((currency)::text = ("*SELECT* 1".currency)::text) AND (start_date <= items.date) AND (end_date >= items.date))
  • Heap Blocks: exact=1
  • Buffers: shared hit=3
158. 0.063 0.063 ↑ 4.0 1 1

Bitmap Index Scan on exchange_rates_by_months_idx (cost=0.00..4.45 rows=4 width=0) (actual time=0.063..0.063 rows=1 loops=1)

  • Index Cond: ((account_id = items.account_id) AND ((currency)::text = ("*SELECT* 1".currency)::text) AND (start_date <= items.date) AND (end_date >= items.date))
  • Buffers: shared hit=2
159. 0.004 0.016 ↑ 4.0 1 1

Bitmap Heap Scan on exchange_rates_by_months original_exchange_rates (cost=4.45..16.63 rows=4 width=24) (actual time=0.015..0.016 rows=1 loops=1)

  • Recheck Cond: ((account_id = items.account_id) AND ((currency)::text = ("*SELECT* 1".currency)::text) AND (start_date <= items.date) AND (end_date >= items.date))
  • Heap Blocks: exact=1
  • Buffers: shared hit=3
160. 0.012 0.012 ↑ 4.0 1 1

Bitmap Index Scan on exchange_rates_by_months_idx (cost=0.00..4.45 rows=4 width=0) (actual time=0.012..0.012 rows=1 loops=1)

  • Index Cond: ((account_id = items.account_id) AND ((currency)::text = ("*SELECT* 1".currency)::text) AND (start_date <= items.date) AND (end_date >= items.date))
  • Buffers: shared hit=2
161. 0.003 0.014 ↑ 4.0 1 1

Bitmap Heap Scan on exchange_rates_by_months cost_exchange_rates (cost=4.45..16.63 rows=4 width=24) (actual time=0.014..0.014 rows=1 loops=1)

  • Recheck Cond: ((account_id = items.account_id) AND ((currency)::text = (items.cost_currency)::text) AND (start_date <= items.date) AND (end_date >= items.date))
  • Heap Blocks: exact=1
  • Buffers: shared hit=3
162. 0.011 0.011 ↑ 4.0 1 1

Bitmap Index Scan on exchange_rates_by_months_idx (cost=0.00..4.45 rows=4 width=0) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: ((account_id = items.account_id) AND ((currency)::text = (items.cost_currency)::text) AND (start_date <= items.date) AND (end_date >= items.date))
  • Buffers: shared hit=2
163. 0.004 0.211 ↑ 9.8 12 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=11
164. 0.207 0.207 ↑ 9.8 12 1

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

  • Filter: ((suspended_at)::date >= CURRENT_DATE)
  • Rows Removed by Filter: 342
  • Buffers: shared hit=11
Planning time : 17.416 ms
Execution time : 782.329 ms