explain.depesz.com

PostgreSQL's explain analyze made readable

Result: aknL : Optimization for: plan #Xm5O

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 1,759.136 177,961.362 ↓ 2.0 1,637,202 1

Unique (cost=51,368,352.47..51,451,846.51 rows=814,576 width=1,909) (actual time=162,086.279..177,961.362 rows=1,637,202 loops=1)

2. 86,759.855 176,202.226 ↓ 2.0 1,637,202 1

Sort (cost=51,368,352.47..51,370,388.91 rows=814,576 width=1,909) (actual time=162,086.276..176,202.226 rows=1,637,202 loops=1)

  • Sort Key: concession.name, concession.id_concession, concession.iso_code, prog.id, prog.label, period.id, period.label, period.marker, cp.id, cp.collaborator_id, collaborator.id_old_archi, collaborator.id_concession, collaborator.contract_name, (replace(COALESCE(((abstractpeople.last_name)::text || (SubPlan 1)), (abstractpeople.last_name)::text), '()'::text, ''::text)), abstractpeople.first_name, ((SubPlan 2)), ((SubPlan 3)), ((SubPlan 4)), ((SubPlan 5)), ((SubPlan 6)), collaborator.enabled_at, cp.start_date, cp.start_date_limit, cp.delayed_start_date, cp.delayed_period_date, cp.end_date, cp.createdat, activity_response.id, activity_response.activity_id, activity_response.reference_activity_response_value_id, activity_response.response_date, reference_activity_response.id, reference_activity_response.label, reference_activity_response_value.id, reference_activity_response_value.label, reference_activity_response_value.is_negative_response, activity.id, activity.period_id, activity.reference_activity_response_id, activity.label
  • Sort Method: external merge Disk: 760112kB
3. 20,617.562 89,442.371 ↓ 2.0 1,637,202 1

Hash Left Join (cost=3,771.34..50,614,600.66 rows=814,576 width=1,909) (actual time=103.951..89,442.371 rows=1,637,202 loops=1)

  • Hash Cond: ((activity.reference_activity_response_id = reference_activity_response.id) AND (reference_activity_response_value.reference_activity_response_id = reference_activity_response.id))
4. 1,396.504 3,336.713 ↓ 2.0 1,637,202 1

Hash Left Join (cost=3,770.27..16,394.05 rows=814,576 width=1,565) (actual time=103.664..3,336.713 rows=1,637,202 loops=1)

  • Hash Cond: (activity_response.reference_activity_response_value_id = reference_activity_response_value.id)
5. 1,088.372 1,940.166 ↓ 2.0 1,637,202 1

Hash Join (cost=3,769.04..13,348.35 rows=814,576 width=1,509) (actual time=103.599..1,940.166 rows=1,637,202 loops=1)

  • Hash Cond: (prog.id = period.integration_program_id)
6. 289.234 851.733 ↓ 1.9 276,257 1

Hash Left Join (cost=3,767.28..11,370.31 rows=143,729 width=989) (actual time=103.513..851.733 rows=276,257 loops=1)

  • Hash Cond: (activity_response.activity_id = activity.id)
7. 379.986 561.794 ↓ 1.9 276,257 1

Hash Right Join (cost=3,744.45..10,966.87 rows=143,729 width=810) (actual time=102.786..561.794 rows=276,257 loops=1)

  • Hash Cond: (activity_response.collaborator_integration_program_id = cp.id)
8. 79.077 79.077 ↑ 1.0 287,500 1

Seq Scan on activity_response (cost=0.00..4,707.00 rows=287,500 width=24) (actual time=0.026..79.077 rows=287,500 loops=1)

9. 9.041 102.731 ↓ 1.9 6,582 1

Hash (cost=3,701.23..3,701.23 rows=3,458 width=790) (actual time=102.731..102.731 rows=6,582 loops=1)

  • Buckets: 8192 (originally 4096) Batches: 1 (originally 1) Memory Usage: 1347kB
10. 7.592 93.690 ↓ 1.9 6,582 1

Nested Loop (cost=220.88..3,701.23 rows=3,458 width=790) (actual time=10.518..93.690 rows=6,582 loops=1)

11. 4.002 46.606 ↓ 1.9 6,582 1

Hash Join (cost=220.59..2,033.17 rows=3,458 width=774) (actual time=10.477..46.606 rows=6,582 loops=1)

  • Hash Cond: (prog.concession_id = concession.id_concession)
12. 20.263 42.572 ↓ 1.9 6,582 1

Hash Join (cost=219.48..2,016.57 rows=3,458 width=616) (actual time=10.394..42.572 rows=6,582 loops=1)

  • Hash Cond: (collaborator.id_people = cp.collaborator_id)
13. 11.974 11.974 ↑ 1.0 41,492 1

Seq Scan on collaborator (cost=0.00..1,606.92 rows=41,492 width=44) (actual time=0.019..11.974 rows=41,492 loops=1)

14. 4.253 10.335 ↓ 1.9 6,582 1

Hash (cost=176.25..176.25 rows=3,458 width=572) (actual time=10.335..10.335 rows=6,582 loops=1)

  • Buckets: 8192 (originally 4096) Batches: 1 (originally 1) Memory Usage: 887kB
15. 4.358 6.082 ↓ 1.9 6,582 1

Hash Join (cost=1.10..176.25 rows=3,458 width=572) (actual time=0.045..6.082 rows=6,582 loops=1)

  • Hash Cond: (cp.integration_program_id = prog.id)
16. 1.709 1.709 ↑ 1.0 6,917 1

Seq Scan on collaborator_integration_program cp (cost=0.00..144.17 rows=6,917 width=48) (actual time=0.019..1.709 rows=6,917 loops=1)

17. 0.003 0.015 ↑ 1.0 3 1

Hash (cost=1.06..1.06 rows=3 width=524) (actual time=0.015..0.015 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
18. 0.012 0.012 ↑ 1.0 3 1

Seq Scan on integration_program prog (cost=0.00..1.06 rows=3 width=524) (actual time=0.010..0.012 rows=3 loops=1)

  • Filter: enable
  • Rows Removed by Filter: 3
19. 0.011 0.032 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=162) (actual time=0.032..0.032 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
20. 0.021 0.021 ↑ 1.0 5 1

Seq Scan on concession (cost=0.00..1.05 rows=5 width=162) (actual time=0.018..0.021 rows=5 loops=1)

21. 39.492 39.492 ↑ 1.0 1 6,582

Index Scan using abstractpeople_pkey on abstractpeople (cost=0.29..0.48 rows=1 width=20) (actual time=0.006..0.006 rows=1 loops=6,582)

  • Index Cond: (id_people = collaborator.id_people)
22. 0.329 0.705 ↑ 1.0 481 1

Hash (cost=16.81..16.81 rows=481 width=179) (actual time=0.705..0.705 rows=481 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 92kB
23. 0.376 0.376 ↑ 1.0 481 1

Seq Scan on activity (cost=0.00..16.81 rows=481 width=179) (actual time=0.015..0.376 rows=481 loops=1)

  • Filter: (NOT is_disabled)
24. 0.018 0.061 ↑ 1.0 34 1

Hash (cost=1.34..1.34 rows=34 width=528) (actual time=0.061..0.061 rows=34 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
25. 0.043 0.043 ↑ 1.0 34 1

Seq Scan on period (cost=0.00..1.34 rows=34 width=528) (actual time=0.032..0.043 rows=34 loops=1)

26. 0.026 0.043 ↑ 1.0 10 1

Hash (cost=1.10..1.10 rows=10 width=56) (actual time=0.043..0.043 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
27. 0.017 0.017 ↑ 1.0 10 1

Seq Scan on reference_activity_response_value (cost=0.00..1.10 rows=10 width=56) (actual time=0.013..0.017 rows=10 loops=1)

28. 0.004 0.016 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=150) (actual time=0.016..0.016 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
29. 0.012 0.012 ↑ 1.0 3 1

Seq Scan on reference_activity_response (cost=0.00..1.03 rows=3 width=150) (actual time=0.011..0.012 rows=3 loops=1)

30.          

SubPlan (forHash Left Join)

31. 8,186.010 8,186.010 ↑ 1.0 1 1,637,202

Index Scan using abstractpeople_pkey on abstractpeople jf (cost=0.29..8.31 rows=1 width=32) (actual time=0.004..0.005 rows=1 loops=1,637,202)

  • Index Cond: (id_people = collaborator.id_people)
  • Filter: (birth_name IS NOT NULL)
  • Rows Removed by Filter: 0
32. 1,637.202 9,823.212 ↑ 1.0 1 1,637,202

Nested Loop (cost=0.58..16.62 rows=1 width=4) (actual time=0.006..0.006 rows=1 loops=1,637,202)

33. 4,911.606 4,911.606 ↑ 1.0 1 1,637,202

Index Scan using idx_d20dd34d43ac3d0e on genealogy (cost=0.29..8.31 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1,637,202)

  • Index Cond: (id_collaborator = collaborator.id_people)
34. 3,274.404 3,274.404 ↑ 1.0 1 1,637,202

Index Scan using genealogy_pkey on genealogy niv0 (cost=0.29..8.31 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,637,202)

  • Index Cond: (id_genealogy = genealogy.id_tutor)
35. 1,637.202 13,097.616 ↑ 1.0 1 1,637,202

Nested Loop (cost=0.87..17.05 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=1,637,202)

36. 1,637.202 8,186.010 ↑ 1.0 1 1,637,202

Nested Loop (cost=0.58..16.62 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=1,637,202)

37. 3,274.404 3,274.404 ↑ 1.0 1 1,637,202

Index Scan using idx_d20dd34d43ac3d0e on genealogy genealogy_1 (cost=0.29..8.31 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1,637,202)

  • Index Cond: (id_collaborator = collaborator.id_people)
38. 3,274.404 3,274.404 ↑ 1.0 1 1,637,202

Index Scan using genealogy_pkey on genealogy niv0_1 (cost=0.29..8.31 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,637,202)

  • Index Cond: (id_genealogy = genealogy_1.id_tutor)
39. 3,274.404 3,274.404 ↑ 1.0 1 1,637,202

Index Scan using collaborator_pkey on collaborator parrain (cost=0.29..0.44 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,637,202)

  • Index Cond: (id_people = niv0_1.id_collaborator)
40. 1,637.202 13,097.616 ↑ 1.0 1 1,637,202

Nested Loop (cost=0.87..17.05 rows=1 width=4) (actual time=0.007..0.008 rows=1 loops=1,637,202)

41. 1,637.202 8,186.010 ↑ 1.0 1 1,637,202

Nested Loop (cost=0.58..16.62 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=1,637,202)

42. 3,274.404 3,274.404 ↑ 1.0 1 1,637,202

Index Scan using idx_d20dd34d43ac3d0e on genealogy genealogy_2 (cost=0.29..8.31 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1,637,202)

  • Index Cond: (id_collaborator = collaborator.id_people)
43. 3,274.404 3,274.404 ↑ 1.0 1 1,637,202

Index Scan using genealogy_pkey on genealogy niv0_2 (cost=0.29..8.31 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,637,202)

  • Index Cond: (id_genealogy = genealogy_2.id_tutor)
44. 3,274.404 3,274.404 ↑ 1.0 1 1,637,202

Index Scan using collaborator_pkey on collaborator parrain_1 (cost=0.29..0.44 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,637,202)

  • Index Cond: (id_people = niv0_2.id_collaborator)
45. 11,460.414 11,460.414 ↑ 1.0 1 1,637,202

Seq Scan on constellation (cost=0.00..1.54 rows=1 width=24) (actual time=0.005..0.007 rows=1 loops=1,637,202)

  • Filter: (id = collaborator.id_constellation)
  • Rows Removed by Filter: 42
46. 9,823.212 9,823.212 ↑ 1.0 1 1,637,202

Seq Scan on constellation constellation_1 (cost=0.00..1.54 rows=1 width=146) (actual time=0.004..0.006 rows=1 loops=1,637,202)

  • Filter: (id = collaborator.id_constellation)
  • Rows Removed by Filter: 42
Planning time : 11.540 ms