explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dQ9q

Settings
# exclusive inclusive rows x rows loops node
1. 0.029 18.559 ↑ 1.0 1 1

Sort (cost=543.43..543.43 rows=1 width=1,288) (actual time=18.559..18.559 rows=1 loops=1)

  • Sort Key: patient11_.id
  • Sort Method: quicksort Memory: 26kB
2. 0.004 18.530 ↑ 1.0 1 1

Nested Loop Left Join (cost=249.03..543.42 rows=1 width=1,288) (actual time=17.879..18.530 rows=1 loops=1)

3. 0.001 18.526 ↑ 1.0 1 1

Nested Loop Left Join (cost=248.90..543.25 rows=1 width=1,136) (actual time=17.876..18.526 rows=1 loops=1)

4. 0.001 18.502 ↑ 1.0 1 1

Nested Loop Left Join (cost=248.75..543.06 rows=1 width=1,153) (actual time=17.853..18.502 rows=1 loops=1)

5. 0.004 18.473 ↑ 1.0 1 1

Nested Loop Left Join (cost=248.47..542.32 rows=1 width=1,085) (actual time=17.824..18.473 rows=1 loops=1)

6. 0.019 18.443 ↑ 1.0 1 1

Nested Loop Left Join (cost=248.19..537.51 rows=1 width=1,069) (actual time=17.794..18.443 rows=1 loops=1)

7. 12.322 18.392 ↑ 1.0 1 1

Merge Join (cost=247.92..537.18 rows=1 width=1,018) (actual time=17.743..18.392 rows=1 loops=1)

  • Merge Cond: ((wristbanda1_.attendance_chain_key)::text = (attendance14_.attendance_chain_key)::text)
  • Join Filter: ((outpatient0_1_.attendance_chain_id)::text = (attendance15_.id)::text)
  • Rows Removed by Join Filter: 1694
8. 2.920 4.459 ↓ 1.9 28,815 1

Nested Loop (cost=0.14..250.14 rows=15,066 width=254) (actual time=0.021..4.459 rows=28,815 loops=1)

9. 0.066 0.094 ↓ 1.9 17 1

Nested Loop (cost=0.14..15.89 rows=9 width=180) (actual time=0.017..0.094 rows=17 loops=1)

  • Join Filter: ((wristbanda1_.treatment_id)::text = (wristbande2_.treatment_id)::text)
  • Rows Removed by Join Filter: 170
10. 0.011 0.011 ↑ 1.0 17 1

Index Scan using wristband_attendance_chain_links_uk on wristband_attendance_chain_links wristbanda1_ (cost=0.14..12.39 rows=17 width=180) (actual time=0.006..0.011 rows=17 loops=1)

11. 0.011 0.017 ↓ 1.2 11 17

Materialize (cost=0.00..1.22 rows=9 width=180) (actual time=0.000..0.001 rows=11 loops=17)

12. 0.006 0.006 ↓ 1.2 11 1

Seq Scan on wristbands wristbande2_ (cost=0.00..1.18 rows=9 width=180) (actual time=0.003..0.006 rows=11 loops=1)

  • Filter: (NOT deleted)
  • Rows Removed by Filter: 7
13. 1.248 1.445 ↓ 1.0 1,695 17

Materialize (cost=0.00..50.11 rows=1,674 width=74) (actual time=0.000..0.085 rows=1,695 loops=17)

14. 0.197 0.197 ↓ 1.0 1,695 1

Seq Scan on attendance_chain attendance15_ (cost=0.00..41.74 rows=1,674 width=74) (actual time=0.002..0.197 rows=1,695 loops=1)

15. 0.111 1.611 ↓ 171.1 1,711 1

Sort (cost=247.78..247.81 rows=10 width=1,002) (actual time=1.542..1.611 rows=1,711 loops=1)

  • Sort Key: attendance14_.attendance_chain_key
  • Sort Method: quicksort Memory: 40kB
16. 0.016 1.500 ↓ 1.7 17 1

Nested Loop (cost=208.31..247.62 rows=10 width=1,002) (actual time=1.224..1.500 rows=17 loops=1)

17. 0.013 1.399 ↓ 1.7 17 1

Nested Loop Left Join (cost=208.03..243.20 rows=10 width=928) (actual time=1.213..1.399 rows=17 loops=1)

18. 0.012 1.352 ↓ 1.7 17 1

Hash Left Join (cost=207.76..240.11 rows=10 width=886) (actual time=1.210..1.352 rows=17 loops=1)

  • Hash Cond: ((dictionary8_.id)::text = (dictionary8_1_.id)::text)
19. 0.000 1.333 ↓ 1.7 17 1

Nested Loop Left Join (cost=206.40..238.70 rows=10 width=795) (actual time=1.195..1.333 rows=17 loops=1)

20. 0.000 1.248 ↓ 1.7 17 1

Nested Loop Left Join (cost=206.12..234.73 rows=10 width=826) (actual time=1.194..1.248 rows=17 loops=1)

21. 0.094 1.201 ↓ 1.7 17 1

Hash Right Join (cost=205.85..231.64 rows=10 width=784) (actual time=1.193..1.201 rows=17 loops=1)

  • Hash Cond: ((dictionary8_3_.child_dictionary_item_id)::text = (dictionary8_.id)::text)
22. 0.046 0.046 ↓ 1.0 933 1

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

23. 0.014 1.061 ↓ 1.7 17 1

Hash (cost=205.72..205.72 rows=10 width=747) (actual time=1.061..1.061 rows=17 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
24. 0.004 1.047 ↓ 1.7 17 1

Nested Loop Left Join (cost=170.34..205.72 rows=10 width=747) (actual time=0.969..1.047 rows=17 loops=1)

25. 0.094 0.975 ↓ 1.7 17 1

Hash Right Join (cost=170.06..195.85 rows=10 width=670) (actual time=0.968..0.975 rows=17 loops=1)

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

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

27. 0.015 0.829 ↓ 1.7 17 1

Hash (cost=169.93..169.93 rows=10 width=633) (actual time=0.829..0.829 rows=17 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 7kB
28. 0.010 0.814 ↓ 1.7 17 1

Nested Loop Left Join (cost=5.86..169.93 rows=10 width=633) (actual time=0.126..0.814 rows=17 loops=1)

29. 0.002 0.787 ↓ 1.7 17 1

Nested Loop Left Join (cost=5.72..168.28 rows=10 width=542) (actual time=0.126..0.787 rows=17 loops=1)

30. 0.001 0.683 ↓ 1.7 17 1

Nested Loop Left Join (cost=5.44..161.36 rows=10 width=465) (actual time=0.125..0.683 rows=17 loops=1)

31. 0.017 0.614 ↓ 1.7 17 1

Nested Loop Left Join (cost=5.16..155.59 rows=10 width=414) (actual time=0.125..0.614 rows=17 loops=1)

32. 0.014 0.512 ↓ 1.7 17 1

Nested Loop Left Join (cost=4.89..151.73 rows=10 width=377) (actual time=0.124..0.512 rows=17 loops=1)

33. 0.010 0.379 ↓ 1.7 17 1

Nested Loop (cost=4.61..146.85 rows=10 width=377) (actual time=0.122..0.379 rows=17 loops=1)

34. 0.020 0.213 ↓ 1.7 26 1

Nested Loop (cost=4.33..141.00 rows=15 width=377) (actual time=0.038..0.213 rows=26 loops=1)

35. 0.088 0.088 ↑ 1.0 5 1

Seq Scan on medical_units medicaluni3_ (cost=0.00..22.42 rows=5 width=63) (actual time=0.004..0.088 rows=5 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}'::text[]))
  • Rows Removed by Filter: 354
36. 0.050 0.105 ↑ 1.0 5 5

Bitmap Heap Scan on medical_cases outpatient0_1_ (cost=4.33..23.67 rows=5 width=388) (actual time=0.017..0.021 rows=5 loops=5)

  • Recheck Cond: ((attendant_organization_id)::text = (medicaluni3_.id)::text)
  • 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: 0
37. 0.055 0.055 ↑ 1.2 6 5

Bitmap Index Scan on medical_case_attend_org_fk_i (cost=0.00..4.33 rows=7 width=0) (actual time=0.011..0.011 rows=6 loops=5)

  • Index Cond: ((attendant_organization_id)::text = (medicaluni3_.id)::text)
38. 0.156 0.156 ↑ 1.0 1 26

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.006..0.006 rows=1 loops=26)

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

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

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

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

  • Index Cond: ((financialc4_.id)::text = (id)::text)
41. 0.068 0.068 ↑ 1.0 1 17

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

  • Index Cond: ((outpatient5_.id)::text = (id)::text)
42. 0.102 0.102 ↑ 1.0 1 17

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

  • Index Cond: ((outpatient5_1_.payment_category_id)::text = (id)::text)
43. 0.017 0.017 ↓ 0.0 0 17

Index Scan using foreign_insur_cert_type_pk on foreign_insur_cert_type dictionary6_1_ (cost=0.14..0.16 rows=1 width=91) (actual time=0.001..0.001 rows=0 loops=17)

  • Index Cond: ((dictionary6_.id)::text = (id)::text)
44. 0.068 0.068 ↑ 1.0 1 17

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

  • Index Cond: ((outpatient5_.attendance_type_id)::text = (id)::text)
45. 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)
46. 0.085 0.085 ↑ 1.0 1 17

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

  • Index Cond: ((outpatient5_1_.ojote_result_id)::text = (id)::text)
47. 0.005 0.007 ↑ 1.0 16 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
48. 0.002 0.002 ↑ 1.0 16 1

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

49. 0.034 0.034 ↓ 0.0 0 17

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

  • Index Cond: ((dictionary8_.id)::text = (id)::text)
50. 0.085 0.085 ↑ 1.0 1 17

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

  • Index Cond: ((id)::text = (outpatient0_1_.attendance_chain_id)::text)
51. 0.032 0.032 ↑ 1.0 1 1

Index Scan using referral_notes_pkey on referral_notes referralno9_ (cost=0.27..0.32 rows=1 width=125) (actual time=0.032..0.032 rows=1 loops=1)

  • Index Cond: ((outpatient0_1_.referral_note_id)::text = (id)::text)
52. 0.026 0.026 ↑ 1.0 1 1

Index Scan using diagnoses_pkey on diagnoses diagnosis10_ (cost=0.29..4.80 rows=1 width=90) (actual time=0.026..0.026 rows=1 loops=1)

  • Index Cond: ((referralno9_.sender_diagnosis_id)::text = (id)::text)
53. 0.028 0.028 ↑ 1.0 1 1

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

  • Index Cond: ((outpatient0_1_.patient_id)::text = (id)::text)
54. 0.023 0.023 ↑ 1.0 1 1

Index Scan using employees_pkey on employees employee12_ (cost=0.14..0.18 rows=1 width=57) (actual time=0.022..0.023 rows=1 loops=1)

  • Index Cond: ((outpatient0_1_.attendant_employee_id)::text = (id)::text)
55. 0.000 0.000 ↓ 0.0 0 1

Index Scan using triage_categories_pk on triage_categories triagecate13_ (cost=0.13..0.16 rows=1 width=332) (actual time=0.000..0.000 rows=0 loops=1)

  • Index Cond: ((outpatient0_1_.triage_category_id)::text = (id)::text)