explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lML6 : Optimization for: plan #dPhA

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.023 0.665 ↑ 25.4 7 1

Sort (cost=170.85..171.29 rows=178 width=1,258) (actual time=0.664..0.665 rows=7 loops=1)

  • Output: details.benefit_id, details.employee_id, details.benefit_name, details.benefit_type, details.beneficiary_type, details.benefit_priority, details.benefit_status, details.order_date, details.beneficiary_first_name, details.beneficiary_last_name, details.benefit_start_date, details.benefit_end_date, details.acceptance_date, (CASE WHEN ((details.benefit_status)::text = 'IN_PROGRESS'::text) THEN 1 WHEN ((details.benefit_status)::text = 'ACTIVE'::text) THEN 2 WHEN ((details.benefit_status)::text = 'INACTIVE'::text) THEN 3 ELSE NULL::integer END)
  • Sort Key: (CASE WHEN ((details.benefit_status)::text = 'IN_PROGRESS'::text) THEN 1 WHEN ((details.benefit_status)::text = 'ACTIVE'::text) THEN 2 WHEN ((details.benefit_status)::text = 'INACTIVE'::text) THEN 3 ELSE NULL::integer END), details.benefit_priority, details.benefit_start_date, details.order_date
  • Sort Method: quicksort Memory: 26kB
  • Buffers: shared hit=64
2. 0.009 0.642 ↑ 25.4 7 1

Subquery Scan on details (cost=159.30..164.19 rows=178 width=1,258) (actual time=0.628..0.642 rows=7 loops=1)

  • Output: details.benefit_id, details.employee_id, details.benefit_name, details.benefit_type, details.beneficiary_type, details.benefit_priority, details.benefit_status, details.order_date, details.beneficiary_first_name, details.beneficiary_last_name, details.benefit_start_date, details.benefit_end_date, details.acceptance_date, CASE WHEN ((details.benefit_status)::text = 'IN_PROGRESS'::text) THEN 1 WHEN ((details.benefit_status)::text = 'ACTIVE'::text) THEN 2 WHEN ((details.benefit_status)::text = 'INACTIVE'::text) THEN 3 ELSE NULL::integer END
  • Buffers: shared hit=64
3. 0.032 0.633 ↑ 25.4 7 1

HashAggregate (cost=159.30..161.08 rows=178 width=1,254) (actual time=0.624..0.633 rows=7 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit.name, benefit_type.name, benefit_type.beneficiary_type, benefit_type.priority, ('IN_PROGRESS'::character varying), benefit_order.order_date, (CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.beneficiary_first_name WHEN (employee_benefit.id IS NOT NULL) THEN employee_benefit.beneficiary_first_name ELSE NULL::character varying END), (CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.beneficiary_last_name WHEN (employee_benefit.id IS NOT NULL) THEN employee_benefit.beneficiary_last_name ELSE NULL::character varying END), (CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.benefit_start_date WHEN (rebo.benefit_order_id IS NOT NULL) THEN rebo.benefit_start_date ELSE NULL::timestamp without time zone END), (CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.benefit_end_date WHEN (rebo.benefit_order_id IS NOT NULL) THEN rebo.benefit_end_date ELSE NULL::timestamp without time zone END), (max(benefit_order_consent_given_by_employee.given_at))
  • Group Key: benefit_order.id, benefit_order.employee_id, benefit.name, benefit_type.name, benefit_type.beneficiary_type, benefit_type.priority, ('IN_PROGRESS'::character varying), benefit_order.order_date, (CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.beneficiary_first_name WHEN (employee_benefit.id IS NOT NULL) THEN employee_benefit.beneficiary_first_name ELSE NULL::character varying END), (CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.beneficiary_last_name WHEN (employee_benefit.id IS NOT NULL) THEN employee_benefit.beneficiary_last_name ELSE NULL::character varying END), (CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.benefit_start_date WHEN (rebo.benefit_order_id IS NOT NULL) THEN rebo.benefit_start_date ELSE NULL::timestamp without time zone END), (CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.benefit_end_date WHEN (rebo.benefit_order_id IS NOT NULL) THEN rebo.benefit_end_date ELSE NULL::timestamp without time zone END), (max(benefit_order_consent_given_by_employee.given_at))
  • Buffers: shared hit=64
4. 0.003 0.601 ↑ 25.4 7 1

Append (cost=75.88..153.51 rows=178 width=1,254) (actual time=0.280..0.601 rows=7 loops=1)

  • Buffers: shared hit=64
5. 0.018 0.283 ↑ 59.0 3 1

Hash Right Join (cost=75.88..88.66 rows=177 width=1,254) (actual time=0.279..0.283 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit.name, benefit_type.name, benefit_type.beneficiary_type, benefit_type.priority, 'IN_PROGRESS'::character varying, benefit_order.order_date, CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.beneficiary_first_name WHEN (employee_benefit.id IS NOT NULL) THEN employee_benefit.beneficiary_first_name ELSE NULL::character varying END, CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.beneficiary_last_name WHEN (employee_benefit.id IS NOT NULL) THEN employee_benefit.beneficiary_last_name ELSE NULL::character varying END, CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.benefit_start_date WHEN (rebo.benefit_order_id IS NOT NULL) THEN rebo.benefit_start_date ELSE NULL::timestamp without time zone END, CASE WHEN (bbo.benefit_order_id IS NOT NULL) THEN bbo.benefit_end_date WHEN (rebo.benefit_order_id IS NOT NULL) THEN rebo.benefit_end_date ELSE NULL::timestamp without time zone END, (max(benefit_order_consent_given_by_employee.given_at))
  • Hash Cond: (rebo.benefit_order_id = benefit_order.id)
  • Buffers: shared hit=10
6. 0.009 0.027 ↑ 32.5 4 1

Hash Left Join (cost=10.68..22.33 rows=130 width=1,080) (actual time=0.021..0.027 rows=4 loops=1)

  • Output: rebo.benefit_order_id, rebo.benefit_start_date, rebo.benefit_end_date, employee_benefit.id, employee_benefit.beneficiary_first_name, employee_benefit.beneficiary_last_name
  • Inner Unique: true
  • Hash Cond: (rebo.employee_benefit_id = employee_benefit.id)
  • Buffers: shared hit=2
7. 0.007 0.007 ↑ 32.5 4 1

Seq Scan on benefit_order.reactivate_employee_benefit_order rebo (cost=0.00..11.30 rows=130 width=48) (actual time=0.005..0.007 rows=4 loops=1)

  • Output: rebo.benefit_order_id, rebo.benefit_start_date, rebo.benefit_end_date, rebo.employee_benefit_id
  • Buffers: shared hit=1
8. 0.004 0.011 ↑ 7.5 4 1

Hash (cost=10.30..10.30 rows=30 width=1,048) (actual time=0.010..0.011 rows=4 loops=1)

  • Output: employee_benefit.id, employee_benefit.beneficiary_first_name, employee_benefit.beneficiary_last_name
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
9. 0.007 0.007 ↑ 7.5 4 1

Seq Scan on employee_benefit.employee_benefit (cost=0.00..10.30 rows=30 width=1,048) (actual time=0.004..0.007 rows=4 loops=1)

  • Output: employee_benefit.id, employee_benefit.beneficiary_first_name, employee_benefit.beneficiary_last_name
  • Buffers: shared hit=1
10. 0.004 0.238 ↑ 5.0 3 1

Hash (cost=65.02..65.02 rows=15 width=2,206) (actual time=0.238..0.238 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date, bbo.benefit_order_id, bbo.beneficiary_first_name, bbo.beneficiary_last_name, bbo.benefit_start_date, bbo.benefit_end_date, benefit.name, benefit_type.name, benefit_type.beneficiary_type, benefit_type.priority, (max(benefit_order_consent_given_by_employee.given_at))
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=8
11. 0.010 0.234 ↑ 5.0 3 1

Hash Join (cost=53.08..65.02 rows=15 width=2,206) (actual time=0.230..0.234 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date, bbo.benefit_order_id, bbo.beneficiary_first_name, bbo.beneficiary_last_name, bbo.benefit_start_date, bbo.benefit_end_date, benefit.name, benefit_type.name, benefit_type.beneficiary_type, benefit_type.priority, (max(benefit_order_consent_given_by_employee.given_at))
  • Hash Cond: (benefit_type.id = benefit.benefit_type_id)
  • Buffers: shared hit=8
12. 0.015 0.015 ↑ 32.5 4 1

Seq Scan on benefit_catalog.benefit_type (cost=0.00..11.30 rows=130 width=582) (actual time=0.014..0.015 rows=4 loops=1)

  • Output: benefit_type.id, benefit_type.benefit_group_type_id, benefit_type.name, benefit_type.priority, benefit_type.beneficiary_type
  • Buffers: shared hit=1
13. 0.004 0.209 ↑ 5.0 3 1

Hash (cost=52.90..52.90 rows=15 width=1,632) (actual time=0.208..0.209 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date, bbo.benefit_order_id, bbo.beneficiary_first_name, bbo.beneficiary_last_name, bbo.benefit_start_date, bbo.benefit_end_date, benefit.name, benefit.benefit_type_id, (max(benefit_order_consent_given_by_employee.given_at))
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=7
14. 0.011 0.205 ↑ 5.0 3 1

Hash Join (cost=42.20..52.90 rows=15 width=1,632) (actual time=0.200..0.205 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date, bbo.benefit_order_id, bbo.beneficiary_first_name, bbo.beneficiary_last_name, bbo.benefit_start_date, bbo.benefit_end_date, benefit.name, benefit.benefit_type_id, (max(benefit_order_consent_given_by_employee.given_at))
  • Hash Cond: (benefit.id = bbo.benefit_id)
  • Buffers: shared hit=7
15. 0.005 0.005 ↑ 10.0 4 1

Seq Scan on benefit_catalog.benefit (cost=0.00..10.40 rows=40 width=524) (actual time=0.004..0.005 rows=4 loops=1)

  • Output: benefit.id, benefit.name, benefit.description, benefit.objects_link, benefit.benefit_group_id, benefit.benefit_type_id, benefit.benefit_variant_id, benefit.benefit_provider_product_id, benefit.image_id, benefit.benefit_category_id
  • Buffers: shared hit=1
16. 0.004 0.189 ↑ 5.0 3 1

Hash (cost=42.01..42.01 rows=15 width=1,116) (actual time=0.189..0.189 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date, bbo.benefit_order_id, bbo.beneficiary_first_name, bbo.beneficiary_last_name, bbo.benefit_start_date, bbo.benefit_end_date, bbo.benefit_id, (max(benefit_order_consent_given_by_employee.given_at))
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=6
17. 0.011 0.185 ↑ 5.0 3 1

Hash Join (cost=31.42..42.01 rows=15 width=1,116) (actual time=0.179..0.185 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date, bbo.benefit_order_id, bbo.beneficiary_first_name, bbo.beneficiary_last_name, bbo.benefit_start_date, bbo.benefit_end_date, bbo.benefit_id, (max(benefit_order_consent_given_by_employee.given_at))
  • Hash Cond: (bbo.benefit_order_id = benefit_order.id)
  • Buffers: shared hit=6
18. 0.011 0.011 ↑ 5.7 7 1

Seq Scan on benefit_order.buy_benefit_order bbo (cost=0.00..10.40 rows=40 width=1,068) (actual time=0.007..0.011 rows=7 loops=1)

  • Output: bbo.benefit_order_id, bbo.beneficiary_first_name, bbo.beneficiary_last_name, bbo.benefit_start_date, bbo.benefit_end_date, bbo.benefit_id
  • Buffers: shared hit=1
19. 0.003 0.163 ↑ 1.3 3 1

Hash (cost=31.37..31.37 rows=4 width=48) (actual time=0.163..0.163 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date, (max(benefit_order_consent_given_by_employee.given_at))
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=5
20. 0.013 0.160 ↑ 1.3 3 1

Hash Right Join (cost=30.68..31.37 rows=4 width=48) (actual time=0.153..0.160 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date, (max(benefit_order_consent_given_by_employee.given_at))
  • Inner Unique: true
  • Hash Cond: (benefit_order_1.id = benefit_order.id)
  • Buffers: shared hit=5
21. 0.020 0.128 ↑ 3.3 9 1

HashAggregate (cost=29.46..29.76 rows=30 width=24) (actual time=0.124..0.128 rows=9 loops=1)

  • Output: benefit_order_1.id, max(benefit_order_consent_given_by_employee.given_at)
  • Group Key: benefit_order_1.id
  • Buffers: shared hit=4
22. 0.029 0.108 ↑ 1.6 19 1

HashAggregate (cost=28.71..29.01 rows=30 width=24) (actual time=0.100..0.108 rows=19 loops=1)

  • Output: benefit_order_1.id, benefit_order_consent_given_by_employee.given_at
  • Group Key: benefit_order_1.id, benefit_order_consent_given_by_employee.given_at
  • Buffers: shared hit=4
23. 0.007 0.079 ↑ 1.2 25 1

Append (cost=1.26..28.56 rows=30 width=24) (actual time=0.024..0.079 rows=25 loops=1)

  • Buffers: shared hit=4
24. 0.024 0.047 ↓ 1.1 21 1

Hash Join (cost=1.26..16.33 rows=20 width=24) (actual time=0.024..0.047 rows=21 loops=1)

  • Output: benefit_order_1.id, benefit_order_consent_given_by_employee.given_at
  • Inner Unique: true
  • Hash Cond: (benefit_order_consent_given_by_employee.benefit_order_id = benefit_order_1.id)
  • Buffers: shared hit=2
25. 0.010 0.010 ↑ 16.7 24 1

Seq Scan on consent.benefit_order_consent_given_by_employee (cost=0.00..14.00 rows=400 width=24) (actual time=0.005..0.010 rows=24 loops=1)

  • Output: benefit_order_consent_given_by_employee.id, benefit_order_consent_given_by_employee.benefit_order_id, benefit_order_consent_given_by_employee.employee_id, benefit_order_consent_given_by_employee.given_at, benefit_order_consent_given_by_employee.benefit_buy_consent_type
  • Buffers: shared hit=1
26. 0.005 0.013 ↑ 1.1 9 1

Hash (cost=1.14..1.14 rows=10 width=16) (actual time=0.013..0.013 rows=9 loops=1)

  • Output: benefit_order_1.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
27. 0.008 0.008 ↑ 1.1 9 1

Seq Scan on benefit_order.benefit_order benefit_order_1 (cost=0.00..1.14 rows=10 width=16) (actual time=0.004..0.008 rows=9 loops=1)

  • Output: benefit_order_1.id
  • Filter: ((benefit_order_1.status)::text <> 'WAITING_FOR_REQUIRED_ACTIONS'::text)
  • Rows Removed by Filter: 2
  • Buffers: shared hit=1
28. 0.007 0.025 ↑ 2.5 4 1

Hash Join (cost=1.26..11.78 rows=10 width=24) (actual time=0.021..0.025 rows=4 loops=1)

  • Output: benefit_order_2.id, benefit_order_consent_given_by_family_member_or_friend.given_at
  • Inner Unique: true
  • Hash Cond: (benefit_order_consent_given_by_family_member_or_friend.benefit_order_id = benefit_order_2.id)
  • Buffers: shared hit=2
29. 0.006 0.006 ↑ 10.0 4 1

Seq Scan on consent.benefit_order_consent_given_by_family_member_or_friend (cost=0.00..10.40 rows=40 width=24) (actual time=0.005..0.006 rows=4 loops=1)

  • Output: benefit_order_consent_given_by_family_member_or_friend.id, benefit_order_consent_given_by_family_member_or_friend.benefit_order_id, benefit_order_consent_given_by_family_member_or_friend.first_name, benefit_order_consent_given_by_family_member_or_friend.last_name, benefit_order_consent_given_by_family_member_or_friend.email, benefit_order_consent_given_by_family_member_or_friend.given_at, benefit_order_consent_given_by_family_member_or_friend.benefit_buy_consent_type
  • Buffers: shared hit=1
30. 0.005 0.012 ↑ 1.1 9 1

Hash (cost=1.14..1.14 rows=10 width=16) (actual time=0.011..0.012 rows=9 loops=1)

  • Output: benefit_order_2.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
31. 0.007 0.007 ↑ 1.1 9 1

Seq Scan on benefit_order.benefit_order benefit_order_2 (cost=0.00..1.14 rows=10 width=16) (actual time=0.004..0.007 rows=9 loops=1)

  • Output: benefit_order_2.id
  • Filter: ((benefit_order_2.status)::text <> 'WAITING_FOR_REQUIRED_ACTIONS'::text)
  • Rows Removed by Filter: 2
  • Buffers: shared hit=1
32. 0.005 0.019 ↑ 1.3 3 1

Hash (cost=1.17..1.17 rows=4 width=40) (actual time=0.019..0.019 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
33. 0.014 0.014 ↑ 1.3 3 1

Seq Scan on benefit_order.benefit_order (cost=0.00..1.17 rows=4 width=40) (actual time=0.011..0.014 rows=3 loops=1)

  • Output: benefit_order.id, benefit_order.employee_id, benefit_order.order_date
  • Filter: ((benefit_order.status)::text = ANY ('{WAITING_FOR_REQUIRED_ACTIONS,READY_TO_PROCESS,SENT_TO_BENEFIT_PROVIDER_PLATFORM,RECEIVED_ON_BENEFIT_PROVIDER_PLATFORM}'::text[]))
  • Rows Removed by Filter: 8
  • Buffers: shared hit=1
34. 0.009 0.315 ↓ 4.0 4 1

Nested Loop Left Join (cost=49.22..62.18 rows=1 width=2,308) (actual time=0.243..0.315 rows=4 loops=1)

  • Output: eb.id, eb.employee_id, benefit_1.name, benefit_type_1.name, benefit_type_1.beneficiary_type, benefit_type_1.priority, eb.employee_benefit_status, result_with_row_number.order_date, eb.beneficiary_first_name, eb.beneficiary_last_name, eb.start_date, eb.end_date, (max(benefit_order_consent_given_by_employee_1.given_at))
  • Inner Unique: true
  • Join Filter: (benefit_order_5.id = result_with_row_number.benefit_order_id)
  • Rows Removed by Join Filter: 10
  • Buffers: shared hit=54
35. 0.008 0.182 ↓ 4.0 4 1

Nested Loop (cost=19.76..31.74 rows=1 width=2,316) (actual time=0.125..0.182 rows=4 loops=1)

  • Output: eb.id, eb.employee_id, eb.employee_benefit_status, eb.beneficiary_first_name, eb.beneficiary_last_name, eb.start_date, eb.end_date, benefit_1.name, benefit_type_1.name, benefit_type_1.beneficiary_type, benefit_type_1.priority, result_with_row_number.order_date, result_with_row_number.benefit_order_id
  • Inner Unique: true
  • Buffers: shared hit=50
36. 0.008 0.166 ↓ 4.0 4 1

Nested Loop (cost=19.61..30.36 rows=1 width=1,742) (actual time=0.119..0.166 rows=4 loops=1)

  • Output: eb.id, eb.employee_id, eb.employee_benefit_status, eb.beneficiary_first_name, eb.beneficiary_last_name, eb.start_date, eb.end_date, benefit_1.name, benefit_1.benefit_type_id, result_with_row_number.order_date, result_with_row_number.benefit_order_id
  • Inner Unique: true
  • Buffers: shared hit=42
37. 0.008 0.150 ↓ 4.0 4 1

Nested Loop (cost=19.47..28.53 rows=1 width=1,226) (actual time=0.113..0.150 rows=4 loops=1)

  • Output: eb.id, eb.employee_id, eb.employee_benefit_status, eb.beneficiary_first_name, eb.beneficiary_last_name, eb.start_date, eb.end_date, eb.benefit_id, result_with_row_number.order_date, result_with_row_number.benefit_order_id
  • Inner Unique: true
  • Buffers: shared hit=34
38. 0.004 0.130 ↓ 4.0 4 1

Subquery Scan on result_with_row_number (cost=19.33..19.85 rows=1 width=40) (actual time=0.107..0.130 rows=4 loops=1)

  • Output: result_with_row_number.benefit_order_id, result_with_row_number.order_date, result_with_row_number.employee_benefit_id, result_with_row_number.row_number
  • Filter: (result_with_row_number.row_number = 1)
  • Rows Removed by Filter: 4
  • Buffers: shared hit=26
39. 0.027 0.126 ↑ 2.0 8 1

WindowAgg (cost=19.33..19.65 rows=16 width=48) (actual time=0.106..0.126 rows=8 loops=1)

  • Output: buy_benefit_order.benefit_order_id, benefit_order_3.order_date, buy_benefit_order.employee_benefit_id, row_number() OVER (?)
  • Buffers: shared hit=26
40. 0.016 0.099 ↑ 2.0 8 1

Sort (cost=19.33..19.37 rows=16 width=40) (actual time=0.097..0.099 rows=8 loops=1)

  • Output: benefit_order_3.order_date, buy_benefit_order.employee_benefit_id, buy_benefit_order.benefit_order_id
  • Sort Key: buy_benefit_order.employee_benefit_id, benefit_order_3.order_date DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=26
41. 0.004 0.083 ↑ 2.0 8 1

Result (cost=0.14..19.01 rows=16 width=40) (actual time=0.020..0.083 rows=8 loops=1)

  • Output: benefit_order_3.order_date, buy_benefit_order.employee_benefit_id, buy_benefit_order.benefit_order_id
  • Buffers: shared hit=26
42. 0.003 0.079 ↑ 2.0 8 1

Append (cost=0.14..18.85 rows=16 width=40) (actual time=0.019..0.079 rows=8 loops=1)

  • Buffers: shared hit=26
43. 0.011 0.045 ↑ 1.0 4 1

Nested Loop (cost=0.14..9.30 rows=4 width=40) (actual time=0.018..0.045 rows=4 loops=1)

  • Output: buy_benefit_order.benefit_order_id, benefit_order_3.order_date, buy_benefit_order.employee_benefit_id
  • Buffers: shared hit=13
44. 0.010 0.010 ↓ 8.0 8 1

Seq Scan on benefit_order.benefit_order benefit_order_3 (cost=0.00..1.14 rows=1 width=24) (actual time=0.005..0.010 rows=8 loops=1)

  • Output: benefit_order_3.id, benefit_order_3.status, benefit_order_3.order_date, benefit_order_3.employee_id
  • Filter: ((benefit_order_3.status)::text = 'COMPLETED'::text)
  • Rows Removed by Filter: 3
  • Buffers: shared hit=1
45. 0.024 0.024 ↓ 0.0 0 8

Index Scan using idx__buy_benefit_order__benefit_order_id on benefit_order.buy_benefit_order (cost=0.14..8.16 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=8)

  • Output: buy_benefit_order.benefit_order_id, buy_benefit_order.employee_benefit_id
  • Index Cond: (buy_benefit_order.benefit_order_id = benefit_order_3.id)
  • Buffers: shared hit=12
46. 0.007 0.031 ↑ 3.0 4 1

Nested Loop (cost=0.14..9.31 rows=12 width=40) (actual time=0.015..0.031 rows=4 loops=1)

  • Output: reactivate_employee_benefit_order.benefit_order_id, benefit_order_4.order_date, reactivate_employee_benefit_order.employee_benefit_id
  • Buffers: shared hit=13
47. 0.008 0.008 ↓ 8.0 8 1

Seq Scan on benefit_order.benefit_order benefit_order_4 (cost=0.00..1.14 rows=1 width=24) (actual time=0.004..0.008 rows=8 loops=1)

  • Output: benefit_order_4.id, benefit_order_4.status, benefit_order_4.order_date, benefit_order_4.employee_id
  • Filter: ((benefit_order_4.status)::text = 'COMPLETED'::text)
  • Rows Removed by Filter: 3
  • Buffers: shared hit=1
48. 0.016 0.016 ↓ 0.0 0 8

Index Scan using idx__reactivate_employee_benefit_order__benefit_order_id on benefit_order.reactivate_employee_benefit_order (cost=0.14..8.16 rows=1 width=32) (actual time=0.002..0.002 rows=0 loops=8)

  • Output: reactivate_employee_benefit_order.benefit_order_id, reactivate_employee_benefit_order.employee_benefit_id
  • Index Cond: (reactivate_employee_benefit_order.benefit_order_id = benefit_order_4.id)
  • Buffers: shared hit=12
49. 0.012 0.012 ↑ 1.0 1 4

Index Scan using employee_benefit_pkey on employee_benefit.employee_benefit eb (cost=0.14..8.15 rows=1 width=1,202) (actual time=0.003..0.003 rows=1 loops=4)

  • Output: eb.id, eb.benefit_id, eb.financing_method_id, eb.subscription_id, eb.employee_benefit_number, eb.employee_id, eb.employee_benefit_status, eb.start_date, eb.end_date, eb.beneficiary_first_name, eb.beneficiary_last_name, eb.beneficiary_email, eb.price_variant_id
  • Index Cond: (eb.id = result_with_row_number.employee_benefit_id)
  • Buffers: shared hit=8
50. 0.008 0.008 ↑ 1.0 1 4

Index Scan using benefit_pkey on benefit_catalog.benefit benefit_1 (cost=0.14..1.76 rows=1 width=524) (actual time=0.002..0.002 rows=1 loops=4)

  • Output: benefit_1.id, benefit_1.name, benefit_1.description, benefit_1.objects_link, benefit_1.benefit_group_id, benefit_1.benefit_type_id, benefit_1.benefit_variant_id, benefit_1.benefit_provider_product_id, benefit_1.image_id, benefit_1.benefit_category_id
  • Index Cond: (benefit_1.id = eb.benefit_id)
  • Buffers: shared hit=8
51. 0.008 0.008 ↑ 1.0 1 4

Index Scan using benefit_type_pkey on benefit_catalog.benefit_type benefit_type_1 (cost=0.14..1.36 rows=1 width=582) (actual time=0.002..0.002 rows=1 loops=4)

  • Output: benefit_type_1.id, benefit_type_1.benefit_group_type_id, benefit_type_1.name, benefit_type_1.priority, benefit_type_1.beneficiary_type
  • Index Cond: (benefit_type_1.id = benefit_1.benefit_type_id)
  • Buffers: shared hit=8
52. 0.024 0.124 ↑ 7.5 4 4

HashAggregate (cost=29.46..29.76 rows=30 width=24) (actual time=0.029..0.031 rows=4 loops=4)

  • Output: benefit_order_5.id, max(benefit_order_consent_given_by_employee_1.given_at)
  • Group Key: benefit_order_5.id
  • Buffers: shared hit=4
53. 0.025 0.100 ↑ 1.6 19 1

HashAggregate (cost=28.71..29.01 rows=30 width=24) (actual time=0.092..0.100 rows=19 loops=1)

  • Output: benefit_order_5.id, benefit_order_consent_given_by_employee_1.given_at
  • Group Key: benefit_order_5.id, benefit_order_consent_given_by_employee_1.given_at
  • Buffers: shared hit=4
54. 0.008 0.075 ↑ 1.2 25 1

Append (cost=1.26..28.56 rows=30 width=24) (actual time=0.022..0.075 rows=25 loops=1)

  • Buffers: shared hit=4
55. 0.023 0.044 ↓ 1.1 21 1

Hash Join (cost=1.26..16.33 rows=20 width=24) (actual time=0.022..0.044 rows=21 loops=1)

  • Output: benefit_order_5.id, benefit_order_consent_given_by_employee_1.given_at
  • Inner Unique: true
  • Hash Cond: (benefit_order_consent_given_by_employee_1.benefit_order_id = benefit_order_5.id)
  • Buffers: shared hit=2
56. 0.009 0.009 ↑ 16.7 24 1

Seq Scan on consent.benefit_order_consent_given_by_employee benefit_order_consent_given_by_employee_1 (cost=0.00..14.00 rows=400 width=24) (actual time=0.004..0.009 rows=24 loops=1)

  • Output: benefit_order_consent_given_by_employee_1.id, benefit_order_consent_given_by_employee_1.benefit_order_id, benefit_order_consent_given_by_employee_1.employee_id, benefit_order_consent_given_by_employee_1.given_at, benefit_order_consent_given_by_employee_1.benefit_buy_consent_type
  • Buffers: shared hit=1
57. 0.005 0.012 ↑ 1.1 9 1

Hash (cost=1.14..1.14 rows=10 width=16) (actual time=0.012..0.012 rows=9 loops=1)

  • Output: benefit_order_5.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
58. 0.007 0.007 ↑ 1.1 9 1

Seq Scan on benefit_order.benefit_order benefit_order_5 (cost=0.00..1.14 rows=10 width=16) (actual time=0.004..0.007 rows=9 loops=1)

  • Output: benefit_order_5.id
  • Filter: ((benefit_order_5.status)::text <> 'WAITING_FOR_REQUIRED_ACTIONS'::text)
  • Rows Removed by Filter: 2
  • Buffers: shared hit=1
59. 0.007 0.023 ↑ 2.5 4 1

Hash Join (cost=1.26..11.78 rows=10 width=24) (actual time=0.019..0.023 rows=4 loops=1)

  • Output: benefit_order_6.id, benefit_order_consent_given_by_family_member_or_friend_1.given_at
  • Inner Unique: true
  • Hash Cond: (benefit_order_consent_given_by_family_member_or_friend_1.benefit_order_id = benefit_order_6.id)
  • Buffers: shared hit=2
60. 0.004 0.004 ↑ 10.0 4 1

Seq Scan on consent.benefit_order_consent_given_by_family_member_or_friend benefit_order_consent_given_by_family_member_or_friend_1 (cost=0.00..10.40 rows=40 width=24) (actual time=0.003..0.004 rows=4 loops=1)

  • Output: benefit_order_consent_given_by_family_member_or_friend_1.id, benefit_order_consent_given_by_family_member_or_friend_1.benefit_order_id, benefit_order_consent_given_by_family_member_or_friend_1.first_name, benefit_order_consent_given_by_family_member_or_friend_1.last_name, benefit_order_consent_given_by_family_member_or_friend_1.email, benefit_order_consent_given_by_family_member_or_friend_1.given_at, benefit_order_consent_given_by_family_member_or_friend_1.benefit_buy_consent_type
  • Buffers: shared hit=1
61. 0.005 0.012 ↑ 1.1 9 1

Hash (cost=1.14..1.14 rows=10 width=16) (actual time=0.011..0.012 rows=9 loops=1)

  • Output: benefit_order_6.id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
62. 0.007 0.007 ↑ 1.1 9 1

Seq Scan on benefit_order.benefit_order benefit_order_6 (cost=0.00..1.14 rows=10 width=16) (actual time=0.003..0.007 rows=9 loops=1)

  • Output: benefit_order_6.id
  • Filter: ((benefit_order_6.status)::text <> 'WAITING_FOR_REQUIRED_ACTIONS'::text)
  • Rows Removed by Filter: 2
  • Buffers: shared hit=1
Planning time : 4.300 ms
Execution time : 1.133 ms