explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VmOb

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 1,176.340 ↓ 30.5 43,818 1

Gather (cost=7,881.12..33,743.60 rows=1,435 width=1,912) (actual time=80.457..1,176.340 rows=43,818 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
2. 7.460 488.899 ↓ 26.0 21,909 2 / 2

Hash Left Join (cost=6,881.12..12,719.95 rows=844 width=947) (actual time=51.093..488.899 rows=21,909 loops=2)

  • Hash Cond: (spa.interpretation_notes_pre_defined_text_id = pdtip.id)
3. 8.082 480.619 ↓ 26.0 21,909 2 / 2

Hash Left Join (cost=6,690.92..12,527.53 rows=844 width=907) (actual time=50.255..480.619 rows=21,909 loops=2)

  • Hash Cond: (spa.clinical_information_pre_defined_text_id = pdticp.id)
4. 15.124 471.351 ↓ 26.0 21,909 2 / 2

Nested Loop Left Join (cost=6,509.36..12,343.75 rows=844 width=867) (actual time=49.057..471.351 rows=21,909 loops=2)

5. 25.584 456.227 ↓ 26.0 21,909 2 / 2

Nested Loop Left Join (cost=6,509.08..12,090.80 rows=844 width=832) (actual time=49.050..456.227 rows=21,909 loops=2)

  • Join Filter: ((ar.type)::text = 'text'::text)
6. 7.586 408.734 ↓ 26.0 21,909 2 / 2

Hash Left Join (cost=6,508.66..11,709.28 rows=844 width=838) (actual time=49.015..408.734 rows=21,909 loops=2)

  • Hash Cond: (sr.id = ica.commentable_id)
7. 11.639 400.301 ↓ 26.0 21,909 2 / 2

Hash Left Join (cost=6,268.46..11,462.75 rows=844 width=798) (actual time=48.157..400.301 rows=21,909 loops=2)

  • Hash Cond: ((w.id = rtl.work_order_id) AND (sp.id = rtl.sample_parameter_id))
8. 28.170 386.003 ↓ 26.0 21,902 2 / 2

Nested Loop Left Join (cost=6,019.26..11,196.66 rows=844 width=794) (actual time=45.449..386.003 rows=21,902 loops=2)

9. 10.513 335.931 ↓ 26.0 21,902 2 / 2

Hash Join (cost=6,018.97..10,810.47 rows=844 width=792) (actual time=45.422..335.931 rows=21,902 loops=2)

  • Hash Cond: (w.created_by_id = u.id)
10. 10.854 325.003 ↓ 26.0 21,902 2 / 2

Hash Join (cost=5,995.20..10,784.46 rows=844 width=778) (actual time=44.910..325.003 rows=21,902 loops=2)

  • Hash Cond: (sr.lab_matrix_id = lm.id)
11. 13.262 313.750 ↓ 26.0 21,902 2 / 2

Hash Join (cost=5,978.57..10,765.60 rows=844 width=757) (actual time=44.497..313.750 rows=21,902 loops=2)

  • Hash Cond: (sp.functional_structure_id = fsd.functional_structure_id)
12. 15.343 299.558 ↓ 26.0 21,902 2 / 2

Nested Loop (cost=5,970.14..10,745.56 rows=844 width=190) (actual time=43.553..299.558 rows=21,902 loops=2)

13. 16.692 240.411 ↓ 26.0 21,902 2 / 2

Nested Loop (cost=5,969.86..10,491.75 rows=844 width=148) (actual time=43.519..240.411 rows=21,902 loops=2)

14. 12.876 174.649 ↓ 26.9 12,268 2 / 2

Nested Loop (cost=5,969.43..10,211.11 rows=456 width=130) (actual time=43.479..174.649 rows=12,268 loops=2)

15. 5.713 137.238 ↓ 26.9 12,268 2 / 2

Nested Loop (cost=5,969.15..10,075.00 rows=456 width=74) (actual time=43.462..137.238 rows=12,268 loops=2)

  • Join Filter: (s.registration_id = sr.id)
16. 34.672 94.201 ↓ 24.4 12,442 2 / 2

Parallel Hash Join (cost=5,968.86..9,907.25 rows=509 width=58) (actual time=43.433..94.201 rows=12,442 loops=2)

  • Hash Cond: ((spa.sample_registration_id = s.registration_id) AND (spa.analytical_parameter_id = sp.parameter_id))
17. 16.710 16.710 ↑ 1.2 86,494 2 / 2

Parallel Seq Scan on sample_parameter_assignments spa (cost=0.00..3,172.37 rows=101,737 width=16) (actual time=0.014..16.710 rows=86,494 loops=2)

18. 6.033 42.819 ↑ 1.3 12,442 2 / 2

Parallel Hash (cost=5,726.91..5,726.91 rows=16,130 width=42) (actual time=42.819..42.819 rows=12,442 loops=2)

  • Buckets: 32,768 Batches: 1 Memory Usage: 2,240kB
19. 6.663 36.786 ↑ 1.3 12,442 2 / 2

Nested Loop (cost=856.38..5,726.91 rows=16,130 width=42) (actual time=10.101..36.786 rows=12,442 loops=2)

20. 5.431 18.509 ↑ 1.3 3,872 2 / 2

Hash Join (cost=855.96..2,450.92 rows=4,885 width=30) (actual time=10.064..18.509 rows=3,872 loops=2)

  • Hash Cond: (s.work_order_id = w.id)
21. 3.075 3.075 ↑ 1.2 25,124 2 / 2

Parallel Seq Scan on samples s (cost=0.00..1,516.99 rows=29,699 width=12) (actual time=0.010..3.075 rows=25,124 loops=2)

22. 1.285 10.003 ↓ 1.0 5,455 2 / 2

Hash (cost=789.08..789.08 rows=5,350 width=22) (actual time=10.003..10.003 rows=5,455 loops=2)

  • Buckets: 8,192 Batches: 1 Memory Usage: 359kB
23. 8.718 8.718 ↓ 1.0 5,455 2 / 2

Index Scan using idx_received_at on work_orders w (cost=0.29..789.08 rows=5,350 width=22) (actual time=0.047..8.718 rows=5,455 loops=2)

  • Index Cond: ((received_at >= '2019-12-31 23:59:59'::timestamp without time zone) AND (received_at <= '2020-01-31 23:59:59'::timestamp without time zone))
  • Filter: active
  • Rows Removed by Filter: 55
24. 11.614 11.614 ↑ 2.0 3 7,743 / 2

Index Scan using index_sample_parameters_on_sample_id_and_position on sample_parameters sp (cost=0.42..0.61 rows=6 width=16) (actual time=0.003..0.003 rows=3 loops=7,743)

  • Index Cond: (sample_id = s.id)
25. 37.325 37.325 ↑ 1.0 1 24,883 / 2

Index Scan using sample_registrations_pkey on sample_registrations sr (cost=0.29..0.32 rows=1 width=28) (actual time=0.003..0.003 rows=1 loops=24,883)

  • Index Cond: (id = spa.sample_registration_id)
  • Filter: active
  • Rows Removed by Filter: 0
26. 24.535 24.535 ↑ 1.0 1 24,535 / 2

Index Scan using analytical_parameters_pkey on analytical_parameters ap (cost=0.28..0.30 rows=1 width=64) (actual time=0.002..0.002 rows=1 loops=24,535)

  • Index Cond: (id = spa.analytical_parameter_id)
27. 49.070 49.070 ↑ 2.5 2 24,535 / 2

Index Scan using index_analytical_results_sample_parameter_id on analytical_results ar (cost=0.42..0.57 rows=5 width=22) (actual time=0.004..0.004 rows=2 loops=24,535)

  • Index Cond: (sample_parameter_id = sp.id)
28. 43.804 43.804 ↑ 1.0 1 43,804 / 2

Index Scan using result_definitions_pkey on result_definitions rd (cost=0.28..0.30 rows=1 width=50) (actual time=0.002..0.002 rows=1 loops=43,804)

  • Index Cond: (id = ar.definition_id)
29. 0.024 0.930 ↑ 1.0 82 2 / 2

Hash (cost=7.41..7.41 rows=82 width=575) (actual time=0.930..0.930 rows=82 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 19kB
30. 0.038 0.906 ↑ 1.0 82 2 / 2

Hash Join (cost=5.05..7.41 rows=82 width=575) (actual time=0.852..0.906 rows=82 loops=2)

  • Hash Cond: (fsd.functional_structure_id = fs.id)
31. 0.032 0.613 ↑ 1.0 82 2 / 2

Hash Join (cost=1.20..3.34 rows=82 width=520) (actual time=0.586..0.613 rows=82 loops=2)

  • Hash Cond: (fsd.department_id = d.id)
32. 0.221 0.221 ↑ 1.0 82 2 / 2

Seq Scan on functional_structures_departments fsd (cost=0.00..1.82 rows=82 width=8) (actual time=0.215..0.221 rows=82 loops=2)

33. 0.010 0.360 ↑ 1.0 9 2 / 2

Hash (cost=1.09..1.09 rows=9 width=520) (actual time=0.360..0.360 rows=9 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
34. 0.350 0.350 ↑ 1.0 9 2 / 2

Seq Scan on departments d (cost=0.00..1.09 rows=9 width=520) (actual time=0.348..0.350 rows=9 loops=2)

35. 0.041 0.255 ↑ 1.0 82 2 / 2

Hash (cost=2.82..2.82 rows=82 width=55) (actual time=0.255..0.255 rows=82 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 16kB
36. 0.214 0.214 ↑ 1.0 82 2 / 2

Seq Scan on functional_structures fs (cost=0.00..2.82 rows=82 width=55) (actual time=0.190..0.214 rows=82 loops=2)

37. 0.057 0.399 ↑ 1.0 339 2 / 2

Hash (cost=12.39..12.39 rows=339 width=25) (actual time=0.399..0.399 rows=339 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 28kB
38. 0.342 0.342 ↑ 1.0 339 2 / 2

Seq Scan on lab_matrices lm (cost=0.00..12.39 rows=339 width=25) (actual time=0.231..0.342 rows=339 loops=2)

39. 0.078 0.415 ↑ 1.0 390 2 / 2

Hash (cost=18.90..18.90 rows=390 width=22) (actual time=0.415..0.415 rows=390 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 30kB
40. 0.337 0.337 ↑ 1.0 390 2 / 2

Seq Scan on users u (cost=0.00..18.90 rows=390 width=22) (actual time=0.232..0.337 rows=390 loops=2)

41. 21.902 21.902 ↑ 1.0 1 43,804 / 2

Index Scan using patients_pk on patients p (cost=0.29..0.46 rows=1 width=10) (actual time=0.001..0.001 rows=1 loops=43,804)

  • Index Cond: (id = w.patient_id)
42. 1.282 2.659 ↑ 1.0 7,248 2 / 2

Hash (cost=140.48..140.48 rows=7,248 width=12) (actual time=2.659..2.659 rows=7,248 loops=2)

  • Buckets: 8,192 Batches: 1 Memory Usage: 376kB
43. 1.377 1.377 ↑ 1.0 7,248 2 / 2

Seq Scan on responsability_term_lines rtl (cost=0.00..140.48 rows=7,248 width=12) (actual time=0.258..1.377 rows=7,248 loops=2)

44. 0.001 0.847 ↓ 0.0 0 2 / 2

Hash (cost=239.17..239.17 rows=82 width=48) (actual time=0.847..0.847 rows=0 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
45. 0.000 0.846 ↓ 0.0 0 2 / 2

Nested Loop Left Join (cost=0.28..239.17 rows=82 width=48) (actual time=0.846..0.846 rows=0 loops=2)

46. 0.846 0.846 ↓ 0.0 0 2 / 2

Seq Scan on report_notes ica (cost=0.00..134.27 rows=82 width=8) (actual time=0.845..0.846 rows=0 loops=2)

  • Filter: ((report_note_definition_id = 3) AND ((commentable_type)::text = 'SampleRegistration'::text))
  • Rows Removed by Filter: 2,818
47. 0.000 0.000 ↓ 0.0 0 / 2

Index Scan using pre_defined_texts_pkey on pre_defined_texts pdtica (cost=0.28..1.28 rows=1 width=48) (never executed)

  • Index Cond: (id = ica.pre_defined_text_id)
  • Filter: ((master_type)::text = 'comment'::text)
48. 21.909 21.909 ↓ 0.0 0 43,818 / 2

Index Scan using text_result_values_pkey on text_result_values trv (cost=0.42..0.44 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=43,818)

  • Index Cond: (id = ar.value_id)
49. 0.000 0.000 ↓ 0.0 0 43,818 / 2

Index Scan using pre_defined_results_pkey on pre_defined_results pdr (cost=0.28..0.30 rows=1 width=43) (actual time=0.000..0.000 rows=0 loops=43,818)

  • Index Cond: (id = trv.text_result_pre_defined_text_id)
50. 0.160 1.186 ↑ 1.0 718 2 / 2

Hash (cost=172.59..172.59 rows=718 width=48) (actual time=1.186..1.186 rows=718 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 70kB
51. 1.026 1.026 ↑ 1.0 718 2 / 2

Seq Scan on pre_defined_texts pdticp (cost=0.00..172.59 rows=718 width=48) (actual time=0.232..1.026 rows=718 loops=2)

  • Filter: ((master_type)::text = 'comment'::text)
  • Rows Removed by Filter: 1,409
52. 0.279 0.820 ↑ 1.0 1,409 2 / 2

Hash (cost=172.59..172.59 rows=1,409 width=48) (actual time=0.820..0.820 rows=1,409 loops=2)

  • Buckets: 2,048 Batches: 1 Memory Usage: 126kB
53. 0.541 0.541 ↑ 1.0 1,409 2 / 2

Seq Scan on pre_defined_texts pdtip (cost=0.00..172.59 rows=1,409 width=48) (actual time=0.009..0.541 rows=1,409 loops=2)

  • Filter: ((master_type)::text = 'interpretation'::text)
  • Rows Removed by Filter: 718
54.          

SubPlan (for Gather)

55. 43.818 262.908 ↓ 0.0 0 43,818

Limit (cost=3.77..3.78 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=43,818)

56. 43.818 219.090 ↓ 0.0 0 43,818

Sort (cost=3.77..3.78 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=43,818)

  • Sort Key: report_parametro.created_at
  • Sort Method: quicksort Memory: 25kB
57. 175.272 175.272 ↓ 0.0 0 43,818

Index Scan using index_analytical_reports_on_work_order_id_and_preview on analytical_reports report_parametro (cost=0.42..3.76 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=43,818)

  • Index Cond: ((work_order_id = w.id) AND (preview = false))
  • Filter: ((NOT partial) AND (sample_id = s.id) AND (sample_parameter_id = sp.id))
  • Rows Removed by Filter: 2
58. 0.000 219.090 ↓ 0.0 0 43,818

Limit (cost=3.77..3.77 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=43,818)

59. 43.818 219.090 ↓ 0.0 0 43,818

Sort (cost=3.77..3.77 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=43,818)

  • Sort Key: report_amostra.created_at
  • Sort Method: quicksort Memory: 25kB
60. 175.272 175.272 ↓ 0.0 0 43,818

Index Scan using index_analytical_reports_on_work_order_id_and_preview on analytical_reports report_amostra (cost=0.42..3.76 rows=1 width=8) (actual time=0.003..0.004 rows=0 loops=43,818)

  • Index Cond: ((work_order_id = w.id) AND (preview = false))
  • Filter: ((sample_parameter_id IS NULL) AND (NOT partial) AND (sample_id = s.id))
  • Rows Removed by Filter: 2
61. 0.000 136.416 ↓ 0.0 0 34,104

Limit (cost=3.76..3.77 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=34,104)

62. 34.104 136.416 ↓ 0.0 0 34,104

Sort (cost=3.76..3.77 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=34,104)

  • Sort Key: report_requisicao.created_at
  • Sort Method: quicksort Memory: 25kB
63. 102.312 102.312 ↓ 0.0 0 34,104

Index Scan using index_analytical_reports_on_work_order_id_and_preview on analytical_reports report_requisicao (cost=0.42..3.75 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=34,104)

  • Index Cond: ((work_order_id = w.id) AND (preview = false))
  • Filter: ((sample_id IS NULL) AND (sample_parameter_id IS NULL) AND (NOT partial))
  • Rows Removed by Filter: 1
64. 43.818 350.544 ↑ 1.0 1 43,818

Limit (cost=2.52..2.52 rows=1 width=12) (actual time=0.008..0.008 rows=1 loops=43,818)

65. 43.818 306.726 ↑ 1.0 1 43,818

Sort (cost=2.52..2.52 rows=1 width=12) (actual time=0.007..0.007 rows=1 loops=43,818)

  • Sort Key: technical_parameters.lab_matrix_id, technical_parameters.functional_structure_id, technical_parameters.response_time_days
  • Sort Method: quicksort Memory: 25kB
66. 262.908 262.908 ↑ 1.0 1 43,818

Index Only Scan using index_technical_params_on_method_param_matrix_and_fstruct_ids on technical_parameters (cost=0.29..2.51 rows=1 width=12) (actual time=0.004..0.006 rows=1 loops=43,818)

  • Index Cond: ((analytical_method_id = ar.analytical_method_id) AND (analytical_parameter_id = sp.parameter_id))
  • Filter: (((lab_matrix_id = sr.lab_matrix_id) OR (lab_matrix_id IS NULL)) AND ((functional_structure_id = sp.functional_structure_id) OR (functional_structure_id IS NULL)))
  • Rows Removed by Filter: 6
  • Heap Fetches: 309,621