explain.depesz.com

PostgreSQL's explain analyze made readable

Result: f86Z

Settings
# exclusive inclusive rows x rows loops node
1. 0.027 1.316 ↑ 1.3 3 1

HashAggregate (cost=118.50..118.54 rows=4 width=29) (actual time=1.315..1.316 rows=3 loops=1)

2. 0.003 1.289 ↓ 3.0 12 1

Append (cost=5.98..118.43 rows=4 width=29) (actual time=0.399..1.289 rows=12 loops=1)

3. 0.003 0.641 ↓ 6.0 6 1

Subquery Scan on *SELECT* 1 (cost=5.98..29.82 rows=1 width=29) (actual time=0.399..0.641 rows=6 loops=1)

4. 0.002 0.638 ↓ 6.0 6 1

Nested Loop (cost=5.98..29.81 rows=1 width=29) (actual time=0.398..0.638 rows=6 loops=1)

5. 0.004 0.558 ↓ 6.0 6 1

Nested Loop Left Join (cost=5.84..29.61 rows=1 width=29) (actual time=0.337..0.558 rows=6 loops=1)

6. 0.005 0.536 ↓ 6.0 6 1

Nested Loop (cost=5.56..28.77 rows=1 width=31) (actual time=0.331..0.536 rows=6 loops=1)

7. 0.011 0.513 ↓ 6.0 6 1

Nested Loop (cost=5.28..27.99 rows=1 width=27) (actual time=0.324..0.513 rows=6 loops=1)

8. 0.033 0.475 ↓ 4.5 9 1

Nested Loop (cost=4.86..24.80 rows=2 width=27) (actual time=0.315..0.475 rows=9 loops=1)

9. 0.232 0.232 ↓ 5.0 5 1

Index Scan using bill_visit_id_idx on bill b (cost=0.42..8.44 rows=1 width=23) (actual time=0.229..0.232 rows=5 loops=1)

  • Index Cond: ((visit_id)::text = 'OP121950'::text)
10. 0.020 0.210 ↑ 1.5 2 5

Bitmap Heap Scan on bill_charge bc (cost=4.44..16.33 rows=3 width=14) (actual time=0.041..0.042 rows=2 loops=5)

  • Recheck Cond: ((bill_no)::text = (b.bill_no)::text)
11. 0.190 0.190 ↑ 1.5 2 5

Bitmap Index Scan on bill_charge_bill_no_index (cost=0.00..4.44 rows=3 width=0) (actual time=0.038..0.038 rows=2 loops=5)

  • Index Cond: ((bill_no)::text = (b.bill_no)::text)
12. 0.027 0.027 ↑ 1.0 1 9

Index Scan using idx_serv_presc_common_order_id on services_prescribed sp (cost=0.42..1.58 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=9)

  • Index Cond: (common_order_id = bc.order_number)
13. 0.018 0.018 ↑ 1.0 1 6

Index Scan using package_prescribed_pkey on package_prescribed pp (cost=0.28..0.77 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=6)

  • Index Cond: (prescription_id = sp.package_ref)
14. 0.018 0.018 ↑ 1.0 1 6

Index Scan using patient_packages_pkey on patient_packages patp (cost=0.28..0.84 rows=1 width=6) (actual time=0.003..0.003 rows=1 loops=6)

  • Index Cond: (pp.pat_package_id = pat_package_id)
15. 0.078 0.078 ↑ 1.0 1 6

Index Scan using packages_pkey on packages p (cost=0.14..0.18 rows=1 width=4) (actual time=0.012..0.013 rows=1 loops=6)

  • Index Cond: (package_id = pp.package_id)
  • Filter: multi_visit_package
16. 0.002 0.277 ↓ 6.0 6 1

Subquery Scan on *SELECT* 2 (cost=5.85..29.15 rows=1 width=29) (actual time=0.074..0.277 rows=6 loops=1)

17. 0.010 0.275 ↓ 6.0 6 1

Nested Loop (cost=5.85..29.14 rows=1 width=29) (actual time=0.073..0.275 rows=6 loops=1)

18. 0.009 0.249 ↓ 8.0 8 1

Nested Loop Left Join (cost=5.71..28.94 rows=1 width=29) (actual time=0.068..0.249 rows=8 loops=1)

19. 0.009 0.224 ↓ 8.0 8 1

Nested Loop (cost=5.43..28.59 rows=1 width=31) (actual time=0.065..0.224 rows=8 loops=1)

20. 0.008 0.199 ↓ 8.0 8 1

Nested Loop (cost=5.15..28.05 rows=1 width=27) (actual time=0.061..0.199 rows=8 loops=1)

21. 0.023 0.164 ↓ 4.5 9 1

Nested Loop (cost=4.86..24.80 rows=2 width=27) (actual time=0.053..0.164 rows=9 loops=1)

22. 0.026 0.026 ↓ 5.0 5 1

Index Scan using bill_visit_id_idx on bill b_1 (cost=0.42..8.44 rows=1 width=23) (actual time=0.022..0.026 rows=5 loops=1)

  • Index Cond: ((visit_id)::text = 'OP121950'::text)
23. 0.010 0.115 ↑ 1.5 2 5

Bitmap Heap Scan on bill_charge bc_1 (cost=4.44..16.33 rows=3 width=14) (actual time=0.023..0.023 rows=2 loops=5)

  • Recheck Cond: ((bill_no)::text = (b_1.bill_no)::text)
24. 0.105 0.105 ↑ 1.5 2 5

Bitmap Index Scan on bill_charge_bill_no_index (cost=0.00..4.44 rows=3 width=0) (actual time=0.021..0.021 rows=2 loops=5)

  • Index Cond: ((bill_no)::text = (b_1.bill_no)::text)
25. 0.027 0.027 ↑ 4.0 1 9

Index Scan using idx_test_presc_common_order_id on tests_prescribed tp (cost=0.29..1.58 rows=4 width=8) (actual time=0.002..0.003 rows=1 loops=9)

  • Index Cond: (common_order_id = bc_1.order_number)
26. 0.016 0.016 ↑ 1.0 1 8

Index Scan using package_prescribed_pkey on package_prescribed pp_1 (cost=0.28..0.53 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=8)

  • Index Cond: (prescription_id = tp.package_ref)
27. 0.016 0.016 ↑ 1.0 1 8

Index Scan using patient_packages_pkey on patient_packages patp_1 (cost=0.28..0.34 rows=1 width=6) (actual time=0.002..0.002 rows=1 loops=8)

  • Index Cond: (pp_1.pat_package_id = pat_package_id)
28. 0.016 0.016 ↑ 1.0 1 8

Index Scan using packages_pkey on packages p_1 (cost=0.14..0.18 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=8)

  • Index Cond: (package_id = pp_1.package_id)
  • Filter: multi_visit_package
  • Rows Removed by Filter: 0
29. 0.000 0.184 ↓ 0.0 0 1

Subquery Scan on *SELECT* 3 (cost=6.27..32.68 rows=1 width=29) (actual time=0.184..0.184 rows=0 loops=1)

30. 0.001 0.184 ↓ 0.0 0 1

Nested Loop Left Join (cost=6.27..32.67 rows=1 width=29) (actual time=0.184..0.184 rows=0 loops=1)

31. 0.001 0.183 ↓ 0.0 0 1

Nested Loop (cost=5.85..29.63 rows=1 width=33) (actual time=0.183..0.183 rows=0 loops=1)

32. 0.000 0.182 ↓ 0.0 0 1

Nested Loop Left Join (cost=5.70..29.44 rows=1 width=33) (actual time=0.182..0.182 rows=0 loops=1)

33. 0.000 0.182 ↓ 0.0 0 1

Nested Loop (cost=5.43..28.59 rows=1 width=35) (actual time=0.182..0.182 rows=0 loops=1)

34. 0.000 0.182 ↓ 0.0 0 1

Nested Loop (cost=5.15..27.81 rows=1 width=31) (actual time=0.182..0.182 rows=0 loops=1)

35. 0.026 0.164 ↓ 4.5 9 1

Nested Loop (cost=4.86..24.80 rows=2 width=27) (actual time=0.055..0.164 rows=9 loops=1)

36. 0.023 0.023 ↓ 5.0 5 1

Index Scan using bill_visit_id_idx on bill b_2 (cost=0.42..8.44 rows=1 width=23) (actual time=0.021..0.023 rows=5 loops=1)

  • Index Cond: ((visit_id)::text = 'OP121950'::text)
37. 0.010 0.115 ↑ 1.5 2 5

Bitmap Heap Scan on bill_charge bcc (cost=4.44..16.33 rows=3 width=14) (actual time=0.023..0.023 rows=2 loops=5)

  • Recheck Cond: ((bill_no)::text = (b_2.bill_no)::text)
38. 0.105 0.105 ↑ 1.5 2 5

Bitmap Index Scan on bill_charge_bill_no_index (cost=0.00..4.44 rows=3 width=0) (actual time=0.021..0.021 rows=2 loops=5)

  • Index Cond: ((bill_no)::text = (b_2.bill_no)::text)
39. 0.018 0.018 ↓ 0.0 0 9

Index Scan using idx_doc_cons_common_order_id on doctor_consultation dc (cost=0.29..1.50 rows=1 width=12) (actual time=0.002..0.002 rows=0 loops=9)

  • Index Cond: (common_order_id = bcc.order_number)
40. 0.000 0.000 ↓ 0.0 0

Index Scan using package_prescribed_pkey on package_prescribed pp_2 (cost=0.28..0.77 rows=1 width=12) (never executed)

  • Index Cond: (prescription_id = dc.package_ref)
41. 0.000 0.000 ↓ 0.0 0

Index Scan using patient_packages_pkey on patient_packages patp_2 (cost=0.28..0.84 rows=1 width=6) (never executed)

  • Index Cond: (pp_2.pat_package_id = pat_package_id)
42. 0.000 0.000 ↓ 0.0 0

Index Scan using packages_pkey on packages p_2 (cost=0.14..0.18 rows=1 width=4) (never executed)

  • Index Cond: (package_id = pp_2.package_id)
  • Filter: multi_visit_package
43. 0.000 0.000 ↓ 0.0 0

Index Scan using bac_activity_id_index on bill_activity_charge bac (cost=0.42..3.02 rows=1 width=15) (never executed)

  • Index Cond: ((activity_id)::text = (dc.consultation_id)::text)
  • Filter: ((activity_code)::text = 'DOC'::text)
44. 0.000 0.184 ↓ 0.0 0 1

Subquery Scan on *SELECT* 4 (cost=5.85..26.79 rows=1 width=29) (actual time=0.184..0.184 rows=0 loops=1)

45. 0.000 0.184 ↓ 0.0 0 1

Nested Loop (cost=5.85..26.78 rows=1 width=29) (actual time=0.184..0.184 rows=0 loops=1)

46. 0.000 0.184 ↓ 0.0 0 1

Nested Loop Left Join (cost=5.70..26.59 rows=1 width=29) (actual time=0.184..0.184 rows=0 loops=1)

47. 0.000 0.184 ↓ 0.0 0 1

Nested Loop (cost=5.43..26.24 rows=1 width=31) (actual time=0.184..0.184 rows=0 loops=1)

48. 0.002 0.184 ↓ 0.0 0 1

Nested Loop (cost=5.15..25.92 rows=1 width=27) (actual time=0.184..0.184 rows=0 loops=1)

49. 0.028 0.164 ↓ 4.5 9 1

Nested Loop (cost=4.86..24.80 rows=2 width=27) (actual time=0.050..0.164 rows=9 loops=1)

50. 0.021 0.021 ↓ 5.0 5 1

Index Scan using bill_visit_id_idx on bill b_3 (cost=0.42..8.44 rows=1 width=23) (actual time=0.020..0.021 rows=5 loops=1)

  • Index Cond: ((visit_id)::text = 'OP121950'::text)
51. 0.005 0.115 ↑ 1.5 2 5

Bitmap Heap Scan on bill_charge bc_2 (cost=4.44..16.33 rows=3 width=14) (actual time=0.023..0.023 rows=2 loops=5)

  • Recheck Cond: ((bill_no)::text = (b_3.bill_no)::text)
52. 0.110 0.110 ↑ 1.5 2 5

Bitmap Index Scan on bill_charge_bill_no_index (cost=0.00..4.44 rows=3 width=0) (actual time=0.022..0.022 rows=2 loops=5)

  • Index Cond: ((bill_no)::text = (b_3.bill_no)::text)
53. 0.018 0.018 ↓ 0.0 0 9

Index Scan using idx_other_serv_presc_common_order_id on other_services_prescribed osp (cost=0.29..0.55 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=9)

  • Index Cond: (common_order_id = bc_2.order_number)
54. 0.000 0.000 ↓ 0.0 0

Index Scan using package_prescribed_pkey on package_prescribed pp_3 (cost=0.28..0.30 rows=1 width=12) (never executed)

  • Index Cond: (prescription_id = osp.package_ref)
55. 0.000 0.000 ↓ 0.0 0

Index Scan using patient_packages_pkey on patient_packages patp_3 (cost=0.28..0.34 rows=1 width=6) (never executed)

  • Index Cond: (pp_3.pat_package_id = pat_package_id)
56. 0.000 0.000 ↓ 0.0 0

Index Scan using packages_pkey on packages p_3 (cost=0.14..0.18 rows=1 width=4) (never executed)

  • Index Cond: (package_id = pp_3.package_id)
  • Filter: multi_visit_package
Total runtime : 2.547 ms