explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0nj9

Settings
# exclusive inclusive rows x rows loops node
1. 0.010 17.434 ↑ 1.0 1 1

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

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

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

3. 0.001 17.420 ↑ 1.0 1 1

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

4. 0.002 17.413 ↑ 1.0 1 1

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

5. 0.002 17.402 ↑ 1.0 1 1

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

6. 0.004 17.391 ↑ 1.0 1 1

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

7. 11.533 17.377 ↑ 1.0 1 1

Merge Join (cost=247.92..537.18 rows=1 width=1,018) (actual time=16.933..17.377 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.630 4.218 ↓ 1.9 28,815 1

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

9. 0.025 0.092 ↓ 1.9 17 1

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

  • Join Filter: ((wristbanda1_.treatment_id)::text = (wristbande2_.treatment_id)::text)
  • Rows Removed by Join Filter: 170
10. 0.016 0.016 ↑ 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.008..0.016 rows=17 loops=1)

11. 0.043 0.051 ↓ 1.2 11 17

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

12. 0.008 0.008 ↓ 1.2 11 1

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

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

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

14. 0.244 0.244 ↓ 1.0 1,695 1

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

15. 0.101 1.626 ↓ 171.1 1,711 1

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

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

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

17. 0.012 1.422 ↓ 1.7 17 1

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

18. 0.016 1.376 ↓ 1.7 17 1

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

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

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

20. 0.000 1.267 ↓ 1.7 17 1

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

21. 0.159 1.220 ↓ 1.7 17 1

Hash Right Join (cost=205.85..231.64 rows=10 width=784) (actual time=1.211..1.220 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.015 1.015 ↓ 1.7 17 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
24. 0.007 1.000 ↓ 1.7 17 1

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

25. 0.096 0.925 ↓ 1.7 17 1

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

  • Hash Cond: ((dictionary6_3_.child_dictionary_item_id)::text = (dictionary6_.id)::text)
26. 0.059 0.059 ↓ 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.059 rows=933 loops=1)

27. 0.015 0.770 ↓ 1.7 17 1

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

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

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

29. 0.000 0.728 ↓ 1.7 17 1

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

30. 0.000 0.645 ↓ 1.7 17 1

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

31. 0.014 0.579 ↓ 1.7 17 1

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

32. 0.052 0.497 ↓ 1.7 17 1

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

33. 0.014 0.360 ↓ 1.7 17 1

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

34. 0.020 0.216 ↓ 1.7 26 1

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

35. 0.096 0.096 ↑ 1.0 5 1

Seq Scan on medical_units medicaluni3_ (cost=0.00..22.42 rows=5 width=63) (actual time=0.006..0.096 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.045 0.100 ↑ 1.0 5 5

Bitmap Heap Scan on medical_cases outpatient0_1_ (cost=4.33..23.67 rows=5 width=388) (actual time=0.015..0.020 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.130 0.130 ↑ 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.005..0.005 rows=1 loops=26)

  • Index Cond: (id = (outpatient0_1_.id)::text)
  • Heap Fetches: 17
39. 0.085 0.085 ↑ 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.005..0.005 rows=1 loops=17)

  • Index Cond: (id = (outpatient0_1_.financial_case_id)::text)
  • Heap Fetches: 14
40. 0.068 0.068 ↑ 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.004..0.004 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.085 0.085 ↑ 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.004..0.005 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.005..0.005 rows=1 loops=17)

  • Index Cond: ((outpatient5_1_.ojote_result_id)::text = (id)::text)
47. 0.003 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
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.102 0.102 ↑ 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.006..0.006 rows=1 loops=17)

  • Index Cond: ((id)::text = (outpatient0_1_.attendance_chain_id)::text)
51. 0.010 0.010 ↑ 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.010..0.010 rows=1 loops=1)

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

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

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

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

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

Index Scan using employees_pkey on employees employee12_ (cost=0.14..0.18 rows=1 width=57) (actual time=0.006..0.006 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)