explain.depesz.com

PostgreSQL's explain analyze made readable

Result: M8LB

Settings
# exclusive inclusive rows x rows loops node
1. 0.049 3.115 ↓ 1.3 16 1

Sort (cost=347.68..347.71 rows=12 width=1,198) (actual time=3.115..3.115 rows=16 loops=1)

  • Sort Key: patient9_.id
  • Sort Method: quicksort Memory: 39kB
2. 0.039 3.066 ↓ 1.3 16 1

Hash Anti Join (cost=228.18..347.47 rows=12 width=1,198) (actual time=2.275..3.066 rows=16 loops=1)

  • Hash Cond: ((attendance12_.attendance_chain_key)::text = (wristbanda15_.attendance_chain_key)::text)
3. 0.003 3.002 ↓ 1.4 17 1

Nested Loop (cost=225.45..344.59 rows=12 width=1,235) (actual time=2.219..3.002 rows=17 loops=1)

4. 0.009 2.897 ↓ 1.4 17 1

Nested Loop Left Join (cost=225.17..339.28 rows=12 width=1,235) (actual time=2.214..2.897 rows=17 loops=1)

5. 0.007 2.752 ↓ 1.4 17 1

Hash Left Join (cost=224.89..334.01 rows=12 width=1,198) (actual time=2.201..2.752 rows=17 loops=1)

  • Hash Cond: ((outpatient0_1_.triage_category_id)::text = (triagecate11_.id)::text)
6. 0.015 2.737 ↓ 1.4 17 1

Nested Loop Left Join (cost=223.78..332.84 rows=12 width=1,046) (actual time=2.188..2.737 rows=17 loops=1)

7. 0.001 2.654 ↓ 1.4 17 1

Nested Loop Left Join (cost=223.64..330.53 rows=12 width=1,063) (actual time=2.187..2.654 rows=17 loops=1)

8. 0.000 2.483 ↓ 1.4 17 1

Nested Loop Left Join (cost=223.36..321.74 rows=12 width=995) (actual time=2.171..2.483 rows=17 loops=1)

9. 0.015 2.467 ↓ 1.4 17 1

Nested Loop Left Join (cost=223.07..263.96 rows=12 width=979) (actual time=2.170..2.467 rows=17 loops=1)

10. 0.014 2.452 ↓ 1.4 17 1

Nested Loop Left Join (cost=222.80..260.02 rows=12 width=928) (actual time=2.170..2.452 rows=17 loops=1)

11. 0.013 2.387 ↓ 1.4 17 1

Hash Left Join (cost=222.53..256.32 rows=12 width=886) (actual time=2.169..2.387 rows=17 loops=1)

  • Hash Cond: ((dictionary6_.id)::text = (dictionary6_1_.id)::text)
12. 0.008 2.369 ↓ 1.4 17 1

Nested Loop Left Join (cost=221.17..254.90 rows=12 width=795) (actual time=2.155..2.369 rows=17 loops=1)

13. 0.030 2.259 ↓ 1.4 17 1

Nested Loop Left Join (cost=220.89..250.13 rows=12 width=826) (actual time=2.155..2.259 rows=17 loops=1)

14. 0.098 2.161 ↓ 1.4 17 1

Hash Right Join (cost=220.62..246.43 rows=12 width=784) (actual time=2.154..2.161 rows=17 loops=1)

  • Hash Cond: ((dictionary6_3_.child_dictionary_item_id)::text = (dictionary6_.id)::text)
15. 0.043 0.043 ↓ 1.0 933 1

Seq Scan on dictionary_item_links dictionary6_3_ (cost=0.00..22.29 rows=929 width=74) (actual time=0.001..0.043 rows=933 loops=1)

16. 0.016 2.020 ↓ 1.4 17 1

Hash (cost=220.47..220.47 rows=12 width=747) (actual time=2.020..2.020 rows=17 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
17. 0.056 2.004 ↓ 1.4 17 1

Nested Loop Left Join (cost=183.11..220.47 rows=12 width=747) (actual time=1.876..2.004 rows=17 loops=1)

18. 0.096 1.880 ↓ 1.4 17 1

Hash Right Join (cost=182.83..208.63 rows=12 width=670) (actual time=1.875..1.880 rows=17 loops=1)

  • Hash Cond: ((dictionary4_3_.child_dictionary_item_id)::text = (dictionary4_.id)::text)
19. 0.080 0.080 ↓ 1.0 933 1

Seq Scan on dictionary_item_links dictionary4_3_ (cost=0.00..22.29 rows=929 width=74) (actual time=0.005..0.080 rows=933 loops=1)

20. 0.012 1.704 ↓ 1.4 17 1

Hash (cost=182.68..182.68 rows=12 width=633) (actual time=1.704..1.704 rows=17 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 7kB
21. 0.010 1.692 ↓ 1.4 17 1

Merge Left Join (cost=182.53..182.68 rows=12 width=633) (actual time=1.688..1.692 rows=17 loops=1)

  • Merge Cond: ((dictionary4_.id)::text = (dictionary4_1_.id)::text)
22. 0.057 1.651 ↓ 1.4 17 1

Sort (cost=181.05..181.08 rows=12 width=542) (actual time=1.651..1.651 rows=17 loops=1)

  • Sort Key: dictionary4_.id
  • Sort Method: quicksort Memory: 33kB
23. 0.008 1.594 ↓ 1.4 17 1

Nested Loop Left Join (cost=24.38..180.83 rows=12 width=542) (actual time=0.524..1.594 rows=17 loops=1)

24. 0.000 1.501 ↓ 1.4 17 1

Nested Loop Left Join (cost=24.09..172.53 rows=12 width=465) (actual time=0.505..1.501 rows=17 loops=1)

25. 0.000 1.416 ↓ 1.4 17 1

Nested Loop Left Join (cost=23.82..165.61 rows=12 width=414) (actual time=0.498..1.416 rows=17 loops=1)

26. 0.008 1.314 ↓ 1.4 17 1

Nested Loop Left Join (cost=23.54..160.97 rows=12 width=377) (actual time=0.485..1.314 rows=17 loops=1)

27. 0.024 1.170 ↓ 1.4 17 1

Nested Loop (cost=23.27..155.12 rows=12 width=377) (actual time=0.442..1.170 rows=17 loops=1)

28. 0.107 0.903 ↓ 1.5 27 1

Hash Join (cost=22.99..148.10 rows=18 width=377) (actual time=0.275..0.903 rows=27 loops=1)

  • Hash Cond: ((outpatient0_1_.attendant_organization_id)::text = (medicaluni1_.id)::text)
29. 0.659 0.659 ↑ 1.0 1,142 1

Seq Scan on medical_cases outpatient0_1_ (cost=0.00..120.57 rows=1,161 width=388) (actual time=0.011..0.659 rows=1,142 loops=1)

  • Filter: ((NOT deleted) AND (((status)::text = 'ACTIVE'::text) OR ((status)::text = 'RECLASSIFICATED'::text) OR (((status)::text = 'ARCHIVE'::text) AND (close_date >= '2019-01-03 00:00:00'::timestamp without time zone) AND (close_date <= '2019-01-04 00:00:00'::timestamp without time zone))))
  • Rows Removed by Filter: 513
30. 0.002 0.137 ↑ 1.0 6 1

Hash (cost=22.91..22.91 rows=6 width=63) (actual time=0.137..0.137 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
31. 0.135 0.135 ↑ 1.0 6 1

Seq Scan on medical_units medicaluni1_ (cost=0.00..22.91 rows=6 width=63) (actual time=0.008..0.135 rows=6 loops=1)

  • Filter: ((id)::text = ANY ('{90b70304-aff5-11e6-a193-10c37b4dac06,d29ea811-31db-11e5-bb74-08002700acae,adddc822-31db-11e5-bb74-08002700acae,d87d83a5-343a-11e5-83e2-08002700acae,9ab8a894-31db-11e5-bb74-08002700acae,e3ca1a7e-31db-11e5-bb74-08002700acae}'::text[]))
  • Rows Removed by Filter: 353
32. 0.243 0.243 ↑ 1.0 1 27

Index Only Scan using outpatient_medical_cases_pkey on outpatient_medical_cases outpatient0_ (cost=0.28..0.38 rows=1 width=37) (actual time=0.009..0.009 rows=1 loops=27)

  • Index Cond: (id = (outpatient0_1_.id)::text)
  • Heap Fetches: 17
33. 0.136 0.136 ↑ 1.0 1 17

Index Only Scan using financial_cases_pk on financial_cases financialc2_ (cost=0.28..0.48 rows=1 width=37) (actual time=0.008..0.008 rows=1 loops=17)

  • Index Cond: (id = (outpatient0_1_.financial_case_id)::text)
  • Heap Fetches: 14
34. 0.102 0.102 ↑ 1.0 1 17

Index Scan using outpatient_financial_cases_pk on outpatient_financial_cases outpatient3_ (cost=0.28..0.38 rows=1 width=74) (actual time=0.005..0.006 rows=1 loops=17)

  • Index Cond: ((financialc2_.id)::text = (id)::text)
35. 0.085 0.085 ↑ 1.0 1 17

Index Scan using financial_cases_pk on financial_cases outpatient3_1_ (cost=0.28..0.57 rows=1 width=125) (actual time=0.005..0.005 rows=1 loops=17)

  • Index Cond: ((outpatient3_.id)::text = (id)::text)
36. 0.085 0.085 ↑ 1.0 1 17

Index Scan using dictionary_items_pkey on dictionary_items dictionary4_ (cost=0.28..0.68 rows=1 width=114) (actual time=0.005..0.005 rows=1 loops=17)

  • Index Cond: ((outpatient3_1_.payment_category_id)::text = (id)::text)
37. 0.027 0.031 ↑ 1.0 16 1

Sort (cost=1.48..1.52 rows=16 width=91) (actual time=0.030..0.031 rows=16 loops=1)

  • Sort Key: dictionary4_1_.id
  • Sort Method: quicksort Memory: 26kB
38. 0.004 0.004 ↑ 1.0 16 1

Seq Scan on foreign_insur_cert_type dictionary4_1_ (cost=0.00..1.16 rows=16 width=91) (actual time=0.003..0.004 rows=16 loops=1)

39. 0.068 0.068 ↑ 1.0 1 17

Index Scan using dictionary_items_pkey on dictionary_items dictionary6_ (cost=0.28..0.98 rows=1 width=114) (actual time=0.004..0.004 rows=1 loops=17)

  • Index Cond: ((outpatient3_.attendance_type_id)::text = (id)::text)
40. 0.068 0.068 ↓ 0.0 0 17

Index Scan using insurance_countries_pkey on insurance_countries dictionary4_2_ (cost=0.27..0.30 rows=1 width=42) (actual time=0.004..0.004 rows=0 loops=17)

  • Index Cond: ((dictionary4_.id)::text = (id)::text)
41. 0.102 0.102 ↑ 1.0 1 17

Index Scan using ojote_result_pk on ojote_result ojoteresul5_ (cost=0.28..0.39 rows=1 width=43) (actual time=0.006..0.006 rows=1 loops=17)

  • Index Cond: ((outpatient3_1_.ojote_result_id)::text = (id)::text)
42. 0.001 0.005 ↑ 1.0 16 1

Hash (cost=1.16..1.16 rows=16 width=91) (actual time=0.005..0.005 rows=16 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
43. 0.004 0.004 ↑ 1.0 16 1

Seq Scan on foreign_insur_cert_type dictionary6_1_ (cost=0.00..1.16 rows=16 width=91) (actual time=0.001..0.004 rows=16 loops=1)

44. 0.051 0.051 ↓ 0.0 0 17

Index Scan using insurance_countries_pkey on insurance_countries dictionary6_2_ (cost=0.27..0.30 rows=1 width=42) (actual time=0.003..0.003 rows=0 loops=17)

  • Index Cond: ((dictionary6_.id)::text = (id)::text)
45. 0.000 0.000 ↓ 0.0 0 17

Index Scan using referral_notes_pkey on referral_notes referralno7_ (cost=0.27..0.32 rows=1 width=125) (actual time=0.000..0.000 rows=0 loops=17)

  • Index Cond: ((outpatient0_1_.referral_note_id)::text = (id)::text)
46. 0.017 0.017 ↓ 0.0 0 17

Index Scan using diagnoses_pkey on diagnoses diagnosis8_ (cost=0.29..4.80 rows=1 width=90) (actual time=0.001..0.001 rows=0 loops=17)

  • Index Cond: ((referralno7_.sender_diagnosis_id)::text = (id)::text)
47. 0.170 0.170 ↑ 1.0 1 17

Index Scan using patients_pkey on patients patient9_ (cost=0.28..0.72 rows=1 width=105) (actual time=0.010..0.010 rows=1 loops=17)

  • Index Cond: ((outpatient0_1_.patient_id)::text = (id)::text)
48. 0.068 0.068 ↑ 1.0 1 17

Index Scan using employees_pkey on employees employee10_ (cost=0.14..0.18 rows=1 width=57) (actual time=0.004..0.004 rows=1 loops=17)

  • Index Cond: ((outpatient0_1_.attendant_employee_id)::text = (id)::text)
49. 0.002 0.008 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=332) (actual time=0.008..0.008 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
50. 0.006 0.006 ↑ 1.0 5 1

Seq Scan on triage_categories triagecate11_ (cost=0.00..1.05 rows=5 width=332) (actual time=0.006..0.006 rows=5 loops=1)

51. 0.136 0.136 ↑ 1.0 1 17

Index Scan using attendance_chain_pk on attendance_chain attendance12_ (cost=0.28..0.43 rows=1 width=74) (actual time=0.008..0.008 rows=1 loops=17)

  • Index Cond: ((outpatient0_1_.attendance_chain_id)::text = (id)::text)
52. 0.102 0.102 ↑ 1.0 1 17

Index Scan using attendance_chain_pk on attendance_chain attendance13_ (cost=0.28..0.43 rows=1 width=74) (actual time=0.005..0.006 rows=1 loops=17)

  • Index Cond: ((id)::text = (outpatient0_1_.attendance_chain_id)::text)
53. 0.004 0.025 ↓ 1.9 17 1

Hash (cost=2.62..2.62 rows=9 width=90) (actual time=0.025..0.025 rows=17 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
54. 0.007 0.021 ↓ 1.9 17 1

Hash Join (cost=1.29..2.62 rows=9 width=90) (actual time=0.018..0.021 rows=17 loops=1)

  • Hash Cond: ((wristbanda15_.treatment_id)::text = (wristbande14_.treatment_id)::text)
55. 0.006 0.006 ↑ 1.0 17 1

Seq Scan on wristband_attendance_chain_links wristbanda15_ (cost=0.00..1.17 rows=17 width=180) (actual time=0.005..0.006 rows=17 loops=1)

56. 0.003 0.008 ↓ 1.2 11 1

Hash (cost=1.18..1.18 rows=9 width=90) (actual time=0.008..0.008 rows=11 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
57. 0.005 0.005 ↓ 1.2 11 1

Seq Scan on wristbands wristbande14_ (cost=0.00..1.18 rows=9 width=90) (actual time=0.004..0.005 rows=11 loops=1)

  • Filter: (NOT deleted)
  • Rows Removed by Filter: 7