explain.depesz.com

PostgreSQL's explain analyze made readable

Result: LtsJ

Settings
# exclusive inclusive rows x rows loops node
1. 0.035 1,016.772 ↑ 1.0 100 1

Limit (cost=31,583.97..34,141.15 rows=100 width=2,169) (actual time=326.968..1,016.772 rows=100 loops=1)

2.          

Initplan (for Limit)

3. 0.023 0.023 ↑ 1.0 1 1

Index Scan using user_email_uq on users (cost=0.28..8.29 rows=1 width=16) (actual time=0.022..0.023 rows=1 loops=1)

  • Index Cond: (email = 'farkasr00@gmail.com'::text)
4. 19.976 1,016.714 ↑ 1,855.9 100 1

Nested Loop Left Join (cost=31,575.67..4,775,694.10 rows=185,594 width=2,169) (actual time=326.966..1,016.714 rows=100 loops=1)

  • Join Filter: ((tbp.registry_id = att.registry_id) AND (tbp.institute_id = ap.institute_id))
  • Rows Removed by Join Filter: 234,682
5. 0.175 320.538 ↑ 1,855.9 100 1

Hash Left Join (cost=31,575.42..87,589.41 rows=185,594 width=2,152) (actual time=318.271..320.538 rows=100 loops=1)

  • Hash Cond: (f.form_type_id = ftc.form_type_id)
6. 0.204 320.295 ↑ 1,855.9 100 1

Hash Left Join (cost=31,570.49..87,071.16 rows=185,594 width=2,144) (actual time=318.195..320.295 rows=100 loops=1)

  • Hash Cond: ((u.id = bs.user_id) AND (f.id = bs.form_id))
7. 0.162 295.842 ↑ 1,855.9 100 1

Nested Loop (cost=30,940.19..85,466.44 rows=185,594 width=2,112) (actual time=293.936..295.842 rows=100 loops=1)

8. 0.033 0.033 ↑ 1.0 1 1

Index Only Scan using users_id_institute_id_idx on users u (cost=0.28..8.29 rows=1 width=16) (actual time=0.033..0.033 rows=1 loops=1)

  • Index Cond: (id = $0)
  • Heap Fetches: 1
9. 0.414 295.647 ↑ 1,855.9 100 1

Hash Right Join (cost=30,939.91..83,602.21 rows=185,594 width=2,096) (actual time=293.900..295.647 rows=100 loops=1)

  • Hash Cond: (f_1.id = f.id)
10. 23.059 75.543 ↑ 1,855.9 100 1

HashAggregate (cost=17,847.01..66,101.45 rows=185,594 width=40) (actual time=74.163..75.543 rows=100 loops=1)

  • Group Key: f_1.id, r.trial_manager_id
11. 35.752 52.484 ↑ 2.2 83,691 1

Hash Join (cost=2,078.24..15,991.07 rows=185,594 width=68) (actual time=9.655..52.484 rows=83,691 loops=1)

  • Hash Cond: (f_1.attendance_period_id = ap_1.id)
  • Join Filter: (((racl.form_type_id = f_1.form_type_id) OR (racl.form_type_id IS NULL)) AND ((racl.physician_id = f_1.physician_id) OR (racl.physician_id IS NULL)))
  • Rows Removed by Join Filter: 32,322
12. 7.162 7.162 ↑ 1.0 43,391 1

Seq Scan on forms f_1 (cost=0.00..10,721.91 rows=43,391 width=80) (actual time=0.062..7.162 rows=43,391 loops=1)

13. 2.067 9.570 ↑ 2.1 15,179 1

Hash (cost=1,676.89..1,676.89 rows=32,108 width=68) (actual time=9.570..9.570 rows=15,179 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,366kB
14. 3.386 7.503 ↑ 2.1 15,179 1

Hash Join (cost=330.21..1,676.89 rows=32,108 width=68) (actual time=2.027..7.503 rows=15,179 loops=1)

  • Hash Cond: (a.registry_id = r.id)
  • Join Filter: ((racl.institute_id = ap_1.institute_id) OR (racl.institute_id IS NULL))
  • Rows Removed by Join Filter: 11,293
15. 1.541 3.743 ↑ 1.0 7,293 1

Hash Join (cost=278.09..509.18 rows=7,293 width=48) (actual time=1.646..3.743 rows=7,293 loops=1)

  • Hash Cond: (ap_1.attendance_id = a.id)
16. 0.564 0.564 ↑ 1.0 7,293 1

Seq Scan on attendance_periods ap_1 (cost=0.00..211.93 rows=7,293 width=48) (actual time=0.004..0.564 rows=7,293 loops=1)

17. 0.816 1.638 ↑ 1.0 7,293 1

Hash (cost=186.93..186.93 rows=7,293 width=32) (actual time=1.638..1.638 rows=7,293 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 520kB
18. 0.822 0.822 ↑ 1.0 7,293 1

Seq Scan on attendances a (cost=0.00..186.93 rows=7,293 width=32) (actual time=0.004..0.822 rows=7,293 loops=1)

19. 0.007 0.374 ↑ 8.5 41 1

Hash (cost=47.74..47.74 rows=350 width=100) (actual time=0.374..0.374 rows=41 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 12kB
20. 0.010 0.367 ↑ 8.5 41 1

Hash Join (cost=19.97..47.74 rows=350 width=100) (actual time=0.243..0.367 rows=41 loops=1)

  • Hash Cond: (racl.registry_id = r.id)
21. 0.062 0.344 ↑ 8.5 41 1

Hash Join (cost=17.25..43.98 rows=350 width=68) (actual time=0.227..0.344 rows=41 loops=1)

  • Hash Cond: (racl.trustee_id = get_trustee_list.trustee_id)
22. 0.063 0.063 ↑ 1.0 700 1

Seq Scan on registry_acl racl (cost=0.00..21.00 rows=700 width=84) (actual time=0.002..0.063 rows=700 loops=1)

23. 0.001 0.219 ↑ 200.0 1 1

Hash (cost=14.75..14.75 rows=200 width=16) (actual time=0.219..0.219 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
24. 0.005 0.218 ↑ 200.0 1 1

HashAggregate (cost=12.75..14.75 rows=200 width=16) (actual time=0.218..0.218 rows=1 loops=1)

  • Group Key: get_trustee_list.trustee_id
25. 0.213 0.213 ↑ 1,000.0 1 1

Function Scan on get_trustee_list (cost=0.25..10.25 rows=1,000 width=16) (actual time=0.213..0.213 rows=1 loops=1)

26. 0.004 0.013 ↑ 1.0 32 1

Hash (cost=2.32..2.32 rows=32 width=32) (actual time=0.013..0.013 rows=32 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
27. 0.009 0.009 ↑ 1.0 32 1

Seq Scan on registries r (cost=0.00..2.32 rows=32 width=32) (actual time=0.005..0.009 rows=32 loops=1)

28. 48.740 219.690 ↑ 1.0 43,391 1

Hash (cost=12,550.52..12,550.52 rows=43,391 width=2,088) (actual time=219.690..219.690 rows=43,391 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 54,198kB
29. 18.325 170.950 ↑ 1.0 43,391 1

Hash Join (cost=907.76..12,550.52 rows=43,391 width=2,088) (actual time=12.292..170.950 rows=43,391 loops=1)

  • Hash Cond: (f.owner_id = o.id)
30. 19.009 152.471 ↑ 1.0 43,391 1

Hash Join (cost=880.88..12,408.83 rows=43,391 width=2,070) (actual time=12.132..152.471 rows=43,391 loops=1)

  • Hash Cond: (f.physician_id = ph.id)
31. 23.291 133.293 ↑ 1.0 43,391 1

Hash Join (cost=854.00..12,267.13 rows=43,391 width=2,001) (actual time=11.959..133.293 rows=43,391 loops=1)

  • Hash Cond: ((att.patient_id = rp.patient_id) AND (att.registry_id = rp.registry_id))
32. 23.808 107.756 ↑ 1.0 43,391 1

Hash Join (cost=596.88..11,782.19 rows=43,391 width=1,991) (actual time=9.694..107.756 rows=43,391 loops=1)

  • Hash Cond: (ap.attendance_id = att.id)
33. 14.831 78.966 ↑ 1.0 43,391 1

Hash Join (cost=318.79..11,390.13 rows=43,391 width=1,836) (actual time=4.696..78.966 rows=43,391 loops=1)

  • Hash Cond: (ap.institute_id = i.id)
34. 22.912 64.013 ↑ 1.0 43,391 1

Hash Join (cost=310.13..11,263.48 rows=43,391 width=1,821) (actual time=4.546..64.013 rows=43,391 loops=1)

  • Hash Cond: (f.attendance_period_id = ap.id)
35. 26.304 36.922 ↑ 1.0 43,391 1

Hash Join (cost=7.04..10,846.42 rows=43,391 width=1,701) (actual time=0.346..36.922 rows=43,391 loops=1)

  • Hash Cond: (f.form_type_id = ft.id)
36. 10.511 10.511 ↑ 1.0 43,391 1

Seq Scan on forms f (cost=0.00..10,721.91 rows=43,391 width=1,669) (actual time=0.211..10.511 rows=43,391 loops=1)

37. 0.030 0.107 ↑ 1.0 135 1

Hash (cost=5.35..5.35 rows=135 width=32) (actual time=0.107..0.107 rows=135 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 17kB
38. 0.077 0.077 ↑ 1.0 135 1

Seq Scan on form_types ft (cost=0.00..5.35 rows=135 width=32) (actual time=0.021..0.077 rows=135 loops=1)

39. 2.281 4.179 ↑ 1.0 7,293 1

Hash (cost=211.93..211.93 rows=7,293 width=136) (actual time=4.179..4.179 rows=7,293 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 1,163kB
40. 1.898 1.898 ↑ 1.0 7,293 1

Seq Scan on attendance_periods ap (cost=0.00..211.93 rows=7,293 width=136) (actual time=0.035..1.898 rows=7,293 loops=1)

41. 0.040 0.122 ↑ 1.0 118 1

Hash (cost=7.18..7.18 rows=118 width=31) (actual time=0.122..0.122 rows=118 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 16kB
42. 0.082 0.082 ↑ 1.0 118 1

Seq Scan on institutes i (cost=0.00..7.18 rows=118 width=31) (actual time=0.035..0.082 rows=118 loops=1)

43. 2.747 4.982 ↑ 1.0 7,293 1

Hash (cost=186.93..186.93 rows=7,293 width=171) (actual time=4.982..4.982 rows=7,293 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 990kB
44. 2.235 2.235 ↑ 1.0 7,293 1

Seq Scan on attendances att (cost=0.00..186.93 rows=7,293 width=171) (actual time=0.009..2.235 rows=7,293 loops=1)

45. 1.298 2.246 ↑ 1.0 6,885 1

Hash (cost=153.85..153.85 rows=6,885 width=42) (actual time=2.246..2.246 rows=6,885 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 562kB
46. 0.948 0.948 ↑ 1.0 6,885 1

Seq Scan on registries_patients rp (cost=0.00..153.85 rows=6,885 width=42) (actual time=0.006..0.948 rows=6,885 loops=1)

47. 0.093 0.169 ↑ 1.0 528 1

Hash (cost=20.28..20.28 rows=528 width=85) (actual time=0.169..0.169 rows=528 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 62kB
48. 0.076 0.076 ↑ 1.0 528 1

Seq Scan on users ph (cost=0.00..20.28 rows=528 width=85) (actual time=0.002..0.076 rows=528 loops=1)

49. 0.065 0.154 ↑ 1.0 528 1

Hash (cost=20.28..20.28 rows=528 width=34) (actual time=0.154..0.154 rows=528 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 43kB
50. 0.089 0.089 ↑ 1.0 528 1

Seq Scan on users o (cost=0.00..20.28 rows=528 width=34) (actual time=0.010..0.089 rows=528 loops=1)

51. 0.294 24.249 ↑ 1.0 1,645 1

Hash (cost=605.63..605.63 rows=1,645 width=64) (actual time=24.249..24.249 rows=1,645 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 459kB
52. 0.115 23.955 ↑ 1.0 1,645 1

Subquery Scan on bs (cost=568.61..605.63 rows=1,645 width=64) (actual time=22.738..23.955 rows=1,645 loops=1)

53. 10.361 23.840 ↑ 1.0 1,645 1

HashAggregate (cost=568.61..589.18 rows=1,645 width=64) (actual time=22.738..23.840 rows=1,645 loops=1)

  • Group Key: u_1.id, fbs.form_id
54. 0.273 13.479 ↑ 1.0 2,912 1

Nested Loop (cost=472.29..539.49 rows=2,912 width=63) (actual time=11.434..13.479 rows=2,912 loops=1)

55. 0.014 0.014 ↑ 1.0 1 1

Index Only Scan using users_id_institute_id_idx on users u_1 (cost=0.28..8.29 rows=1 width=16) (actual time=0.011..0.014 rows=1 loops=1)

  • Index Cond: (id = $0)
  • Heap Fetches: 1
56. 1.112 13.192 ↑ 1.0 2,912 1

Merge Left Join (cost=472.01..502.08 rows=2,912 width=47) (actual time=11.419..13.192 rows=2,912 loops=1)

  • Merge Cond: ((bs_1.registry_id = tbp_1.registry_id) AND (bs_1.institute_id = tbp_1.institute_id))
57. 1.149 2.883 ↑ 1.0 2,912 1

Sort (cost=411.93..419.21 rows=2,912 width=75) (actual time=2.603..2.883 rows=2,912 loops=1)

  • Sort Key: bs_1.registry_id, bs_1.institute_id
  • Sort Method: quicksort Memory: 506kB
58. 0.582 1.734 ↑ 1.0 2,912 1

Hash Join (cost=168.60..244.38 rows=2,912 width=75) (actual time=0.964..1.734 rows=2,912 loops=1)

  • Hash Cond: (fbs.bio_sample_id = bs_1.id)
59. 0.198 0.198 ↑ 1.0 2,912 1

Seq Scan on forms_bio_samples fbs (cost=0.00..68.12 rows=2,912 width=32) (actual time=0.007..0.198 rows=2,912 loops=1)

60. 0.495 0.954 ↑ 1.0 3,449 1

Hash (cost=125.49..125.49 rows=3,449 width=59) (actual time=0.954..0.954 rows=3,449 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 339kB
61. 0.459 0.459 ↑ 1.0 3,449 1

Seq Scan on bio_samples bs_1 (cost=0.00..125.49 rows=3,449 width=59) (actual time=0.003..0.459 rows=3,449 loops=1)

62. 1.528 9.197 ↓ 5.1 5,147 1

Sort (cost=60.08..62.58 rows=1,000 width=36) (actual time=8.790..9.197 rows=5,147 loops=1)

  • Sort Key: tbp_1.registry_id, tbp_1.institute_id
  • Sort Method: quicksort Memory: 281kB
63. 7.669 7.669 ↓ 2.4 2,360 1

Function Scan on trustee_biobank_permissions tbp_1 (cost=0.25..10.25 rows=1,000 width=36) (actual time=7.500..7.669 rows=2,360 loops=1)

64. 0.009 0.068 ↑ 1.0 34 1

Hash (cost=4.51..4.51 rows=34 width=24) (actual time=0.067..0.068 rows=34 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
65. 0.004 0.059 ↑ 1.0 34 1

Subquery Scan on ftc (cost=3.83..4.51 rows=34 width=24) (actual time=0.049..0.059 rows=34 loops=1)

66. 0.032 0.055 ↑ 1.0 34 1

HashAggregate (cost=3.83..4.17 rows=34 width=24) (actual time=0.049..0.055 rows=34 loops=1)

  • Group Key: ftbst.form_type_id
67. 0.023 0.023 ↑ 1.0 122 1

Seq Scan on form_types_bio_sample_types ftbst (cost=0.00..3.22 rows=122 width=16) (actual time=0.015..0.023 rows=122 loops=1)

68. 676.200 676.200 ↓ 2.3 2,348 100

Function Scan on trustee_biobank_permissions tbp (cost=0.25..10.25 rows=1,000 width=36) (actual time=6.646..6.762 rows=2,348 loops=100)

Planning time : 17.393 ms
Execution time : 1,018.236 ms