explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TuA

Settings
# exclusive inclusive rows x rows loops node
1. 655.515 8,392.486 ↑ 205,842.0 1,040 1

GroupAggregate (cost=319,063,204.78..349,699,030.95 rows=214,075,697 width=186) (actual time=7,427.237..8,392.486 rows=1,040 loops=1)

  • Group Key: ufc.institute_name, ufc.user_name
  • Group Key: ufc.institute_name
  • Functions: 95
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 10.487 ms, Inlining 36.912 ms, Optimization 711.211 ms, Emission 419.387 ms, Total 1177.997 ms
2. 2,099.933 7,736.971 ↑ 193.2 1,134,295 1

Sort (cost=319,063,204.78..319,611,186.88 rows=219,192,840 width=126) (actual time=7,427.212..7,736.971 rows=1,134,295 loops=1)

  • Sort Key: ufc.institute_name, ufc.user_name
  • Sort Method: external merge Disk: 242,792kB
3. 69.667 5,637.038 ↑ 193.2 1,134,295 1

Subquery Scan on ufc (cost=219,154,280.94..231,757,869.24 rows=219,192,840 width=126) (actual time=4,759.102..5,637.038 rows=1,134,295 loops=1)

4. 618.330 5,567.371 ↑ 193.2 1,134,295 1

WindowAgg (cost=219,154,280.94..229,565,940.84 rows=219,192,840 width=170) (actual time=4,759.098..5,567.371 rows=1,134,295 loops=1)

5. 1,123.909 4,949.041 ↑ 193.2 1,134,295 1

Sort (cost=219,154,280.94..219,702,263.04 rows=219,192,840 width=150) (actual time=4,758.660..4,949.041 rows=1,134,295 loops=1)

  • Sort Key: tf.attendance_id, tf.target_approval_level
  • Sort Method: external merge Disk: 274,056kB
6. 393.775 3,825.132 ↑ 193.2 1,134,295 1

WindowAgg (cost=117,926,768.50..122,858,607.40 rows=219,192,840 width=150) (actual time=3,155.219..3,825.132 rows=1,134,295 loops=1)

7. 1,355.184 3,431.357 ↑ 193.2 1,134,295 1

Sort (cost=117,926,768.50..118,474,750.60 rows=219,192,840 width=142) (actual time=3,155.090..3,431.357 rows=1,134,295 loops=1)

  • Sort Key: tf.attendance_id, uracl.user_name, tf.target_approval_level
  • Sort Method: external merge Disk: 265,176kB
8. 74.789 2,076.173 ↑ 193.2 1,134,295 1

Nested Loop (cost=123,120.01..24,627,878.95 rows=219,192,840 width=142) (actual time=1,312.447..2,076.173 rows=1,134,295 loops=1)

  • Join Filter: ((uracl.institute_id = i.id) OR (uracl.institute_id IS NULL))
  • Rows Removed by Join Filter: 64,721
9. 340.154 1,934.772 ↑ 166.8 33,306 1

Merge Left Join (cost=122,669.47..14,874,889.03 rows=5,557,001 width=110) (actual time=1,309.302..1,934.772 rows=33,306 loops=1)

  • Merge Cond: (uracl.registry_id = tf.registry_id)
  • Join Filter: (((uracl.form_type_id IS NULL) OR (uracl.form_type_id = tf.form_type_id)) AND ((uracl.institute_id IS NULL) OR (uracl.institute_id = tf.institute_id)) AND ((uracl.physician_id IS NULL) OR (uracl.physician_id = tf.physician_id)) AND (((tf.target_approval_level = 0) AND (uracl.user_id = tf.owner_id)) OR (('frm_approve_'::text || (tf.target_approval_level)::text) = ANY (uracl.permissions))))
  • Rows Removed by Join Filter: 2,693,058
10. 0.080 1,194.982 ↑ 2,124.0 96 1

Sort (cost=106,292.47..106,802.23 rows=203,901 width=130) (actual time=1,194.948..1,194.982 rows=96 loops=1)

  • Sort Key: uracl.registry_id
  • Sort Method: quicksort Memory: 50kB
11. 0.016 1,194.902 ↑ 2,124.0 96 1

Subquery Scan on uracl (cost=22.75..74,370.44 rows=203,901 width=130) (actual time=1,168.839..1,194.902 rows=96 loops=1)

12. 1.801 1,194.886 ↑ 2,124.0 96 1

Nested Loop (cost=22.75..72,331.43 rows=203,901 width=214) (actual time=1,168.837..1,194.886 rows=96 loops=1)

13. 0.091 0.091 ↑ 1.0 514 1

Seq Scan on users u (cost=0.00..19.14 rows=514 width=34) (actual time=0.022..0.091 rows=514 loops=1)

14. 3.598 1,192.994 ↓ 0.0 0 514

Hash Join (cost=22.75..60.25 rows=397 width=68) (actual time=2.319..2.321 rows=0 loops=514)

  • Hash Cond: (racl.trustee_id = trustee_list_id.trustee_id)
15. 1,184.256 1,184.256 ↑ 1.0 96 514

Seq Scan on registry_acl racl (cost=0.00..21.29 rows=96 width=84) (actual time=2.293..2.304 rows=96 loops=514)

  • Filter: (registry_id = 'ce0f4190-a4dc-4a76-a4c8-a993d44cef90'::uuid)
  • Rows Removed by Filter: 567
16. 0.514 5.140 ↑ 1,000.0 1 514

Hash (cost=10.25..10.25 rows=1,000 width=16) (actual time=0.010..0.010 rows=1 loops=514)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
17. 4.626 4.626 ↑ 1,000.0 1 514

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

18. 300.524 399.636 ↓ 162.9 2,726,209 1

Sort (cost=16,377.00..16,418.83 rows=16,735 width=124) (actual time=113.600..399.636 rows=2,726,209 loops=1)

  • Sort Key: tf.registry_id
  • Sort Method: external sort Disk: 3,960kB
19. 2.562 99.112 ↓ 1.7 28,399 1

Subquery Scan on tf (cost=461.88..15,202.99 rows=16,735 width=124) (actual time=3.196..99.112 rows=28,399 loops=1)

20. 70.584 96.550 ↓ 1.7 28,399 1

Hash Join (cost=461.88..15,035.64 rows=16,735 width=124) (actual time=3.195..96.550 rows=28,399 loops=1)

  • Hash Cond: (f.attendance_period_id = ap.id)
21. 23.648 23.648 ↑ 1.0 40,138 1

Seq Scan on forms f (cost=0.00..10,009.38 rows=40,138 width=178) (actual time=0.277..23.648 rows=40,138 loops=1)

22. 0.339 2.318 ↑ 1.0 2,743 1

Hash (cost=427.60..427.60 rows=2,743 width=64) (actual time=2.318..2.318 rows=2,743 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 290kB
23. 0.752 1.979 ↑ 1.0 2,743 1

Hash Join (cost=220.53..427.60 rows=2,743 width=64) (actual time=0.750..1.979 rows=2,743 loops=1)

  • Hash Cond: (ap.attendance_id = a.id)
24. 0.493 0.493 ↑ 1.0 6,579 1

Seq Scan on attendance_periods ap (cost=0.00..189.79 rows=6,579 width=48) (actual time=0.004..0.493 rows=6,579 loops=1)

25. 0.285 0.734 ↑ 1.0 2,743 1

Hash (cost=186.24..186.24 rows=2,743 width=32) (actual time=0.734..0.734 rows=2,743 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 204kB
26. 0.449 0.449 ↑ 1.0 2,743 1

Seq Scan on attendances a (cost=0.00..186.24 rows=2,743 width=32) (actual time=0.008..0.449 rows=2,743 loops=1)

  • Filter: (registry_id = 'ce0f4190-a4dc-4a76-a4c8-a993d44cef90'::uuid)
  • Rows Removed by Filter: 3,836
27. 63.484 66.612 ↑ 3.2 36 33,306

Materialize (cost=450.54..453.47 rows=117 width=64) (actual time=0.000..0.002 rows=36 loops=33,306)

28. 0.006 3.128 ↑ 3.2 36 1

Subquery Scan on i (cost=450.54..452.88 rows=117 width=64) (actual time=3.121..3.128 rows=36 loops=1)

29. 0.291 3.122 ↑ 3.2 36 1

HashAggregate (cost=450.54..451.71 rows=117 width=528) (actual time=3.117..3.122 rows=36 loops=1)

  • Group Key: i_1.id
30. 0.349 2.831 ↑ 1.0 2,743 1

Hash Join (cost=229.16..443.68 rows=2,743 width=64) (actual time=1.209..2.831 rows=2,743 loops=1)

  • Hash Cond: (ap_1.institute_id = i_1.id)
31. 0.758 2.360 ↑ 1.0 2,743 1

Hash Join (cost=220.53..427.60 rows=2,743 width=16) (actual time=1.070..2.360 rows=2,743 loops=1)

  • Hash Cond: (ap_1.attendance_id = a_1.id)
32. 0.574 0.574 ↑ 1.0 6,579 1

Seq Scan on attendance_periods ap_1 (cost=0.00..189.79 rows=6,579 width=32) (actual time=0.014..0.574 rows=6,579 loops=1)

33. 0.340 1.028 ↑ 1.0 2,743 1

Hash (cost=186.24..186.24 rows=2,743 width=16) (actual time=1.028..1.028 rows=2,743 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 161kB
34. 0.688 0.688 ↑ 1.0 2,743 1

Seq Scan on attendances a_1 (cost=0.00..186.24 rows=2,743 width=16) (actual time=0.020..0.688 rows=2,743 loops=1)

  • Filter: (registry_id = 'ce0f4190-a4dc-4a76-a4c8-a993d44cef90'::uuid)
  • Rows Removed by Filter: 3,836
35. 0.032 0.122 ↑ 1.0 117 1

Hash (cost=7.17..7.17 rows=117 width=64) (actual time=0.122..0.122 rows=117 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 20kB
36. 0.090 0.090 ↑ 1.0 117 1

Seq Scan on institutes i_1 (cost=0.00..7.17 rows=117 width=64) (actual time=0.054..0.090 rows=117 loops=1)

Execution time : 8,485.626 ms