explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0PGJ

Settings
# exclusive inclusive rows x rows loops node
1. 0.493 3,131,111.771 ↓ 194.0 194 1

GroupAggregate (cost=1,861,262.55..1,861,264.50 rows=1 width=329) (actual time=3,131,111.201..3,131,111.771 rows=194 loops=1)

  • Group Key: e.number, rg.id, ou.id, egs.name, pd.first_name, pd.last_name, e.employment_type, productcategories.group_name, suppliers.supplier_name, egb1.office_debit, egb1.benefit_tax, eb.accession_date, eb.resignation_date, bp.employer, bp.employer_zfss, bp.employee, bp.cofinanced_by_employeer, bp.cofinanced_by_zfss, payment.id_benefit_instance, bi1.id, spd.id, e.cost_place
  • Filter: (sum(payment.amount) > '0'::numeric)
2. 0.839 3,131,111.278 ↓ 225.0 225 1

Sort (cost=1,861,262.55..1,861,262.65 rows=1 width=256) (actual time=3,131,111.178..3,131,111.278 rows=225 loops=1)

  • Sort Key: e.number, rg.id, ou.id, egs.name, pd.first_name, pd.last_name, e.employment_type, productcategories.group_name, suppliers.supplier_name, egb1.office_debit, egb1.benefit_tax, eb.accession_date, eb.resignation_date, bp.employer, bp.employer_zfss, bp.employee, bp.cofinanced_by_employeer, bp.cofinanced_by_zfss, bi1.id, spd.id, e.cost_place
  • Sort Method: quicksort Memory: 98kB
3. 0.485 3,131,110.439 ↓ 225.0 225 1

Nested Loop Left Join (cost=1,764,484.96..1,861,262.35 rows=1 width=256) (actual time=3,130,910.521..3,131,110.439 rows=225 loops=1)

4. 150.665 3,131,108.829 ↓ 225.0 225 1

Hash Right Join (cost=1,764,476.46..1,861,253.46 rows=1 width=240) (actual time=3,130,909.889..3,131,108.829 rows=225 loops=1)

  • Hash Cond: (bixspd.id_bi = bi1.id)
5. 147.392 147.392 ↑ 1.0 314,787 1

Seq Scan on benefit_instance_x_simple_personal_data bixspd (cost=0.00..73,134.40 rows=315,232 width=16) (actual time=0.015..147.392 rows=314,787 loops=1)

6. 0.789 3,130,810.772 ↓ 225.0 225 1

Hash (cost=1,764,476.21..1,764,476.21 rows=1 width=232) (actual time=3,130,810.772..3,130,810.772 rows=225 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 62kB
7. 0.907 3,130,809.983 ↓ 225.0 225 1

Nested Loop Left Join (cost=3,818.25..1,764,476.21 rows=1 width=232) (actual time=11,641.304..3,130,809.983 rows=225 loops=1)

8. 0.945 3,130,807.501 ↓ 225.0 225 1

Nested Loop Left Join (cost=3,812.60..1,764,470.16 rows=1 width=207) (actual time=11,641.277..3,130,807.501 rows=225 loops=1)

9. 0.778 3,130,804.306 ↓ 225.0 225 1

Nested Loop Left Join (cost=3,804.10..1,764,460.36 rows=1 width=199) (actual time=11,641.245..3,130,804.306 rows=225 loops=1)

10. 0.771 3,130,803.303 ↓ 225.0 225 1

Nested Loop Left Join (cost=3,798.50..1,764,454.38 rows=1 width=199) (actual time=11,641.224..3,130,803.303 rows=225 loops=1)

11. 0.825 3,130,802.307 ↓ 225.0 225 1

Nested Loop Left Join (cost=3,792.95..1,764,448.48 rows=1 width=199) (actual time=11,641.205..3,130,802.307 rows=225 loops=1)

12. 45,217.439 3,130,799.232 ↓ 225.0 225 1

Nested Loop (cost=3,784.50..1,764,438.75 rows=1 width=191) (actual time=11,641.180..3,130,799.232 rows=225 loops=1)

  • Join Filter: (e.id_employee_account = bi1.id_employee_account)
  • Rows Removed by Join Filter: 85880235
13. 1.744 10.153 ↓ 516.0 516 1

Hash Join (cost=22.85..384.56 rows=1 width=60) (actual time=0.122..10.153 rows=516 loops=1)

  • Hash Cond: (e.id_employee_group = egs.id)
14. 8.367 8.367 ↓ 2.2 701 1

Index Scan using employees__id_company_idx on employees e (cost=8.55..288.45 rows=324 width=54) (actual time=0.069..8.367 rows=701 loops=1)

  • Index Cond: (id_company = 194330)
15. 0.007 0.042 ↑ 1.0 2 1

Hash (cost=13.80..13.80 rows=2 width=22) (actual time=0.042..0.042 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
16. 0.035 0.035 ↑ 1.0 2 1

Index Scan using employee_groups_pkey on employee_groups egs (cost=5.60..13.80 rows=2 width=22) (actual time=0.032..0.035 rows=2 loops=1)

  • Index Cond: (id = ANY ('{194394,194404}'::bigint[]))
17. 102,098.762 3,085,571.640 ↓ 5.3 166,435 516

Hash Left Join (cost=3,761.66..1,756,192.44 rows=31,447 width=155) (actual time=127.564..5,979.790 rows=166,435 loops=516)

  • Hash Cond: (benefits.id_product_category = productcategories.id)
18. 26,464.092 2,983,472.784 ↓ 5.3 166,435 516

Gather (cost=3,726.66..1,748,310.08 rows=31,447 width=134) (actual time=127.562..5,781.924 rows=166,435 loops=516)

  • Workers Planned: 2
  • Workers Launched: 2
19. 138,921.648 2,957,008.692 ↓ 4.2 55,478 1,548

Nested Loop (cost=2,726.66..1,744,165.38 rows=13,103 width=134) (actual time=16.968..5,730.637 rows=55,478 loops=1,548)

20. 36,663.864 2,818,085.496 ↓ 4.2 55,478 1,548

Hash Left Join (cost=2,718.16..1,628,178.64 rows=13,103 width=126) (actual time=16.914..5,461.406 rows=55,478 loops=1,548)

  • Hash Cond: (bi1.id_benefit = benefits.id)
21. 147,117.276 2,776,259.568 ↓ 4.2 55,478 1,548

Nested Loop Left Join (cost=45.40..1,622,197.91 rows=13,103 width=118) (actual time=10.069..5,380.348 rows=55,478 loops=1,548)

22. 144,627.576 2,629,140.744 ↓ 4.2 55,478 1,548

Nested Loop Left Join (cost=36.80..1,503,531.41 rows=13,103 width=116) (actual time=10.029..5,095.234 rows=55,478 loops=1,548)

23. 159,823.776 2,484,511.620 ↓ 4.2 55,478 1,548

Nested Loop Left Join (cost=28.20..1,385,891.84 rows=13,103 width=119) (actual time=9.986..4,814.945 rows=55,478 loops=1,548)

24. 245,018.472 2,324,685.780 ↓ 4.2 55,478 1,548

Merge Join (cost=19.75..1,270,488.81 rows=13,103 width=111) (actual time=9.949..4,505.205 rows=55,478 loops=1,548)

  • Merge Cond: (payment.id_benefit_instance = bi1.id)
25. 1,447,032.732 1,447,032.732 ↓ 3.5 55,478 1,548

Parallel Index Scan using payment__id_benefit_instance_idx on payment (cost=11.25..3,439,069.07 rows=15,795 width=31) (actual time=5.799..2,804.327 rows=55,478 loops=1,548)

  • Index Cond: (id_benefit_instance IS NOT NULL)
  • Filter: ((NOT deleted) AND ((status)::text <> 'CANCELED'::text) AND ((payer)::text <> 'ONLINE_PROVISION'::text) AND ((date)::date >= '2019-06-01'::date) AND ((date)::date <= '2019-06-30'::date))
  • Rows Removed by Filter: 2598019
26. 632,634.576 632,634.576 ↓ 1.2 747,420 1,548

Index Scan using benefit_instances_pkey on benefit_instances bi1 (cost=8.50..312,558.11 rows=632,918 width=80) (actual time=0.040..1,226.036 rows=747,420 loops=1,548)

  • Filter: ((NOT temporary) AND ((NOT deleted) OR deleted) AND ((status)::text = 'ACTIVE'::text))
  • Rows Removed by Filter: 14843
27. 2.064 2.064 ↑ 1.0 1 85,880,460

Index Scan using employee_benefits_pkey on employee_benefits eb (cost=8.45..8.81 rows=1 width=24) (actual time=0.004..0.004 rows=1 loops=85,880,460)

  • Index Cond: (bi1.id_employee_benefit = id)
28. 1.548 1.548 ↑ 1.0 1 85,880,460

Index Scan using benefit_payments_pkey on benefit_payments bp (cost=8.60..8.98 rows=1 width=13) (actual time=0.003..0.003 rows=1 loops=85,880,460)

  • Index Cond: (bi1.id_benefit_payments = id)
29. 1.548 1.548 ↑ 1.0 1 85,880,460

Index Scan using employee_group_benefit_pkey on employee_group_benefit egb1 (cost=8.60..9.06 rows=1 width=18) (actual time=0.003..0.003 rows=1 loops=85,880,460)

  • Index Cond: (bi1.id_emoloyee_group_benefit = id)
30. 1,523.232 5,162.064 ↑ 1.0 4,365 1,033

Hash (cost=1,581.51..1,581.51 rows=4,365 width=24) (actual time=10.004..10.004 rows=4,365 loops=1,033)

  • Buckets: 8192 Batches: 1 Memory Usage: 293kB
31. 3,638.832 3,638.832 ↑ 1.0 4,365 1,033

Index Scan using benefits_pkey on benefits (cost=5.65..1,581.51 rows=4,365 width=24) (actual time=0.045..7.052 rows=4,365 loops=1,033)

32. 1.548 1.548 ↑ 1.0 1 85,880,460

Index Only Scan using employee_accounts_pkey on employee_accounts ea (cost=8.50..8.85 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=85,880,460)

  • Index Cond: (id = bi1.id_employee_account)
  • Heap Fetches: 4177193
33. 0.045 0.094 ↑ 1.0 60 1

Hash (cost=20.00..20.00 rows=60 width=37) (actual time=0.094..0.094 rows=60 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
34. 0.049 0.049 ↑ 1.0 60 1

Seq Scan on product_categories productcategories (cost=0.00..20.00 rows=60 width=37) (actual time=0.007..0.049 rows=60 loops=1)

35. 2.250 2.250 ↓ 0.0 0 225

Index Scan using rentable_group_selections_employee_unique on rentable_group_selections rgs (cost=8.45..9.73 rows=1 width=16) (actual time=0.010..0.010 rows=0 loops=225)

  • Index Cond: (id_employee = e.id)
36. 0.225 0.225 ↓ 0.0 0 225

Index Only Scan using rentable_group_pkey on rentable_group rg (cost=5.55..5.90 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=225)

  • Index Cond: (id = rgs.id_rentable_group)
  • Heap Fetches: 0
37. 0.225 0.225 ↓ 0.0 0 225

Index Only Scan using organization_units_pkey on organization_units ou (cost=5.60..5.98 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=225)

  • Index Cond: (id = e.id_organization_unit)
  • Heap Fetches: 0
38. 2.250 2.250 ↑ 1.0 1 225

Index Scan using personal_data_pkey on personal_data pd (cost=8.50..9.80 rows=1 width=24) (actual time=0.010..0.010 rows=1 loops=225)

  • Index Cond: (e.id = id)
39. 1.575 1.575 ↑ 1.0 1 225

Index Scan using suppliers_pkey on suppliers (cost=5.65..6.05 rows=1 width=41) (actual time=0.007..0.007 rows=1 loops=225)

  • Index Cond: (benefits.id_supplier = id)
40. 1.125 1.125 ↓ 0.0 0 225

Index Scan using simple_personal_data_pkey on simple_personal_data spd (cost=8.50..8.89 rows=1 width=24) (actual time=0.005..0.005 rows=0 loops=225)

  • Index Cond: (bixspd.id_spd = id)
Planning time : 17.890 ms
Execution time : 3,131,112.616 ms