explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KTYi

Settings
# exclusive inclusive rows x rows loops node
1. 1.500 760,055.684 ↑ 1.0 1,000 1

Limit (cost=406,885.84..81,466,796.63 rows=1,000 width=1,606) (actual time=10,719.833..760,055.684 rows=1,000 loops=1)

2. 750,037.321 760,054.145 ↑ 1,086.2 1,000 1

Nested Loop Left Join (cost=406,885.84..88,051,491,802.77 rows=1,086,247 width=1,606) (actual time=10,719.832..760,054.145 rows=1,000 loops=1)

3. 12.902 10,016.824 ↑ 1,086.2 1,000 1

Nested Loop Left Join (cost=406,885.56..1,048,281.70 rows=1,086,247 width=1,592) (actual time=9,957.860..10,016.824 rows=1,000 loops=1)

4. 8.688 10,003.922 ↑ 1,276.5 305 1

Nested Loop Left Join (cost=406,885.13..743,203.68 rows=389,347 width=1,551) (actual time=9,957.842..10,003.922 rows=305 loops=1)

5. 2.335 9,995.234 ↑ 1,276.5 305 1

Hash Left Join (cost=406,884.71..538,976.17 rows=389,347 width=1,543) (actual time=9,957.820..9,995.234 rows=305 loops=1)

  • Hash Cond: ((pr.mr_no)::text = (par.mr_no)::text)
6. 117.489 9,992.899 ↑ 1,276.5 305 1

Hash Left Join (cost=406,805.82..535,430.95 rows=389,347 width=1,519) (actual time=9,956.230..9,992.899 rows=305 loops=1)

  • Hash Cond: ((pr.reference_docto_id)::text = (rf.id)::text)
7. 2.201 9,875.410 ↑ 1,276.5 305 1

Hash Left Join (cost=401,761.55..525,073.92 rows=389,347 width=1,497) (actual time=9,839.545..9,875.410 rows=305 loops=1)

  • Hash Cond: ((pr.reference_docto_id)::text = (drf.doctor_id)::text)
8. 0.900 9,873.209 ↑ 1,276.5 305 1

Hash Left Join (cost=401,687.75..522,607.45 rows=389,347 width=1,475) (actual time=9,837.940..9,873.209 rows=305 loops=1)

  • Hash Cond: ((pr.op_type)::text = (otn.op_type)::text)
9. 0.831 9,872.309 ↑ 1,276.5 305 1

Hash Left Join (cost=401,641.07..516,720.57 rows=389,347 width=1,459) (actual time=9,837.922..9,872.309 rows=305 loops=1)

  • Hash Cond: (sa.consultation_type_id = ct.id)
10. 112.592 9,871.478 ↑ 1,276.5 305 1

Hash Left Join (cost=401,628.59..511,354.56 rows=389,347 width=1,426) (actual time=9,837.653..9,871.478 rows=305 loops=1)

  • Hash Cond: (dc.appointment_id = sa.appointment_id)
11. 368.943 9,758.886 ↑ 1,276.5 305 1

Hash Left Join (cost=397,437.40..498,889.75 rows=389,347 width=1,361) (actual time=9,726.062..9,758.886 rows=305 loops=1)

  • Hash Cond: ((pr.mr_no)::text = (pp_1.mr_no)::text)
12. 2.242 9,389.943 ↑ 1,276.5 305 1

Hash Right Join (cost=355,762.33..454,289.39 rows=389,347 width=1,234) (actual time=9,358.147..9,389.943 rows=305 loops=1)

  • Hash Cond: ((pp.mr_no)::text = (pr.mr_no)::text)
13. 0.683 769.457 ↑ 23.5 657 1

Hash Left Join (cost=34,371.98..73,918.67 rows=15,460 width=99) (actual time=739.346..769.457 rows=657 loops=1)

  • Hash Cond: ((dc_1.head)::text = (ct_1.id)::text)
14. 2.218 768.492 ↑ 16.3 657 1

Hash Left Join (cost=34,359.50..72,557.21 rows=10,736 width=65) (actual time=739.048..768.492 rows=657 loops=1)

  • Hash Cond: ((pp.visit_id)::text = (dc_1.patient_id)::text)
15. 0.765 462.909 ↑ 13.0 651 1

Hash Left Join (cost=21,998.44..54,386.17 rows=8,464 width=78) (actual time=435.653..462.909 rows=651 loops=1)

  • Hash Cond: ((md.dept_id)::text = (mdp.dept_id)::text)
16. 0.916 462.089 ↑ 13.0 651 1

Hash Left Join (cost=21,996.11..54,267.47 rows=8,464 width=73) (actual time=435.592..462.089 rows=651 loops=1)

  • Hash Cond: ((pr_1.doctor_id)::text = (md.doctor_id)::text)
17. 2.463 459.445 ↑ 13.0 651 1

Hash Left Join (cost=21,922.31..54,066.70 rows=8,464 width=51) (actual time=433.848..459.445 rows=651 loops=1)

  • Hash Cond: ((pp.visit_id)::text = (pr_1.patient_id)::text)
18. 23.283 23.283 ↑ 13.0 651 1

Seq Scan on s_j_patient_prescription pp (cost=0.00..31,975.11 rows=8,464 width=31) (actual time=0.031..23.283 rows=651 loops=1)

  • Filter: ((presc_type)::text = 'Doctor'::text)
  • Rows Removed by Filter: 164989
19. 211.147 433.699 ↑ 1.0 389,347 1

Hash (cost=17,055.47..17,055.47 rows=389,347 width=36) (actual time=433.699..433.699 rows=389,347 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 27376kB
20. 222.552 222.552 ↑ 1.0 389,347 1

Seq Scan on s_j_patient_registration pr_1 (cost=0.00..17,055.47 rows=389,347 width=36) (actual time=0.005..222.552 rows=389,347 loops=1)

21. 0.824 1.728 ↑ 1.0 1,858 1

Hash (cost=50.58..50.58 rows=1,858 width=38) (actual time=1.728..1.728 rows=1,858 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 129kB
22. 0.904 0.904 ↑ 1.0 1,858 1

Seq Scan on m_doctors md (cost=0.00..50.58 rows=1,858 width=38) (actual time=0.007..0.904 rows=1,858 loops=1)

23. 0.030 0.055 ↑ 1.0 59 1

Hash (cost=1.59..1.59 rows=59 width=21) (actual time=0.055..0.055 rows=59 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 4kB
24. 0.025 0.025 ↑ 1.0 59 1

Seq Scan on m_department mdp (cost=0.00..1.59 rows=59 width=21) (actual time=0.004..0.025 rows=59 loops=1)

25. 146.522 303.365 ↓ 1.0 308,943 1

Hash (cost=8,499.36..8,499.36 rows=308,936 width=19) (actual time=303.365..303.365 rows=308,943 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 15547kB
26. 156.843 156.843 ↓ 1.0 308,943 1

Seq Scan on s_j_doctor_consultation dc_1 (cost=0.00..8,499.36 rows=308,936 width=19) (actual time=0.005..156.843 rows=308,943 loops=1)

27. 0.139 0.282 ↑ 1.0 288 1

Hash (cost=8.88..8.88 rows=288 width=41) (actual time=0.282..0.282 rows=288 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 22kB
28. 0.143 0.143 ↑ 1.0 288 1

Seq Scan on m_consultation_types ct_1 (cost=0.00..8.88 rows=288 width=41) (actual time=0.006..0.143 rows=288 loops=1)

29. 493.929 8,618.244 ↓ 1.1 428,943 1

Hash (cost=261,390.52..261,390.52 rows=389,347 width=1,135) (actual time=8,618.244..8,618.244 rows=428,943 loops=1)

  • Buckets: 16384 Batches: 8 Memory Usage: 23404kB
30. 342.590 8,124.315 ↓ 1.1 428,943 1

Hash Left Join (cost=183,295.73..261,390.52 rows=389,347 width=1,135) (actual time=6,453.161..8,124.315 rows=428,943 loops=1)

  • Hash Cond: ((pr.secondary_sponsor_id)::text = (stm.tpa_id)::text)
31. 390.963 7,781.725 ↓ 1.1 428,943 1

Hash Left Join (cost=183,269.72..259,901.21 rows=389,347 width=1,111) (actual time=6,452.637..7,781.725 rows=428,943 loops=1)

  • Hash Cond: ((pr.primary_sponsor_id)::text = (ptm.tpa_id)::text)
32. 774.818 7,390.762 ↓ 1.1 428,943 1

Hash Right Join (cost=183,243.70..254,799.27 rows=389,347 width=1,087) (actual time=6,452.043..7,390.762 rows=428,943 loops=1)

  • Hash Cond: ((dc.patient_id)::text = (pr.patient_id)::text)
33. 163.943 163.943 ↓ 1.0 308,943 1

Seq Scan on s_j_doctor_consultation dc (cost=0.00..8,499.36 rows=308,936 width=76) (actual time=0.010..163.943 rows=308,943 loops=1)

34. 459.643 6,452.001 ↓ 1.0 391,958 1

Hash (cost=128,186.86..128,186.86 rows=389,347 width=1,027) (actual time=6,452.001..6,452.001 rows=391,958 loops=1)

  • Buckets: 16384 Batches: 8 Memory Usage: 18619kB
35. 320.468 5,992.358 ↓ 1.0 391,958 1

Hash Left Join (cost=12,738.53..128,186.86 rows=389,347 width=1,027) (actual time=254.090..5,992.358 rows=391,958 loops=1)

  • Hash Cond: ((pr.secondary_insurance_co)::text = (sicm.insurance_co_id)::text)
36. 358.142 5,671.890 ↓ 1.0 391,958 1

Hash Left Join (cost=12,713.56..126,698.59 rows=389,347 width=1,003) (actual time=253.446..5,671.890 rows=391,958 loops=1)

  • Hash Cond: ((pr.primary_insurance_co)::text = (picm.insurance_co_id)::text)
37. 313.688 5,313.748 ↓ 1.0 391,958 1

Hash Left Join (cost=12,688.58..121,597.70 rows=389,347 width=979) (actual time=252.787..5,313.748 rows=391,958 loops=1)

  • Hash Cond: ((pr.transfer_destination)::text = (thd.id)::text)
38. 315.238 5,000.060 ↓ 1.0 391,958 1

Hash Left Join (cost=12,657.11..116,340.55 rows=389,347 width=949) (actual time=251.954..5,000.060 rows=391,958 loops=1)

  • Hash Cond: ((pr.transfer_source)::text = (ths.id)::text)
39. 392.508 4,684.822 ↓ 1.0 391,958 1

Hash Left Join (cost=12,625.65..111,083.54 rows=389,347 width=919) (actual time=251.105..4,684.822 rows=391,958 loops=1)

  • Hash Cond: (((pr.encounter_end_type)::character varying)::text = (eet.code)::text)
40. 394.597 4,292.314 ↓ 1.0 391,958 1

Hash Left Join (cost=12,594.50..104,725.50 rows=389,347 width=897) (actual time=251.080..4,292.314 rows=391,958 loops=1)

  • Hash Cond: (((pr.encounter_start_type)::character varying)::text = (est.code)::text)
41. 347.078 3,897.717 ↓ 1.0 391,958 1

Hash Left Join (cost=12,560.65..98,364.76 rows=389,347 width=886) (actual time=251.058..3,897.717 rows=391,958 loops=1)

  • Hash Cond: (pr.encounter_type = etc.id)
42. 342.297 3,550.639 ↓ 1.0 391,958 1

Hash Left Join (cost=12,559.31..93,009.90 rows=389,347 width=867) (actual time=251.036..3,550.639 rows=391,958 loops=1)

  • Hash Cond: (pr.center_id = hcm.center_id)
43. 513.982 3,208.342 ↓ 1.0 391,958 1

Hash Left Join (cost=12,557.57..87,654.64 rows=389,347 width=867) (actual time=250.990..3,208.342 rows=391,958 loops=1)

  • Hash Cond: (pr.plan_id = ipm.plan_id)
44. 321.679 2,694.360 ↓ 1.0 391,958 1

Hash Left Join (cost=10,400.23..78,197.04 rows=389,347 width=824) (actual time=210.761..2,694.360 rows=391,958 loops=1)

  • Hash Cond: ((pr.ward_id)::text = (wn.id)::text)
45. 348.426 2,372.681 ↓ 1.0 391,958 1

Hash Left Join (cost=10,393.71..72,843.36 rows=389,347 width=809) (actual time=210.524..2,372.681 rows=391,958 loops=1)

  • Hash Cond: ((pr.dept_id)::text = (dept.dept_id)::text)
46. 376.859 2,024.178 ↓ 1.0 391,958 1

Hash Left Join (cost=10,391.38..67,487.51 rows=389,347 width=796) (actual time=210.432..2,024.178 rows=391,958 loops=1)

  • Hash Cond: ((pr.doctor_id)::text = (doc.doctor_id)::text)
47. 501.188 1,645.132 ↓ 1.0 391,958 1

Hash Left Join (cost=10,317.58..61,573.50 rows=389,347 width=774) (actual time=208.222..1,645.132 rows=391,958 loops=1)

  • Hash Cond: ((pr.patient_id)::text = (bn.visit_id)::text)
48. 743.122 1,130.352 ↑ 1.0 389,347 1

Hash Join (cost=9,905.25..34,747.66 rows=389,347 width=756) (actual time=194.613..1,130.352 rows=389,347 loops=1)

  • Hash Cond: ((pr.mr_no)::text = (pd.mr_no)::text)
49. 192.664 192.664 ↑ 1.0 389,347 1

Seq Scan on s_j_patient_registration pr (cost=0.00..17,055.47 rows=389,347 width=756) (actual time=0.010..192.664 rows=389,347 loops=1)

50. 96.524 194.566 ↑ 1.0 183,781 1

Hash (cost=7,605.11..7,605.11 rows=184,011 width=15) (actual time=194.566..194.566 rows=183,781 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 8615kB
51. 98.042 98.042 ↑ 1.0 183,781 1

Seq Scan on s_j_patient_details pd (cost=0.00..7,605.11 rows=184,011 width=15) (actual time=0.008..98.042 rows=183,781 loops=1)

52. 7.303 13.592 ↑ 1.0 13,259 1

Hash (cost=246.59..246.59 rows=13,259 width=34) (actual time=13.592..13.592 rows=13,259 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 905kB
53. 6.289 6.289 ↑ 1.0 13,259 1

Seq Scan on s_j_bed_details bn (cost=0.00..246.59 rows=13,259 width=34) (actual time=0.008..6.289 rows=13,259 loops=1)

54. 1.108 2.187 ↑ 1.0 1,858 1

Hash (cost=50.58..50.58 rows=1,858 width=30) (actual time=2.187..2.187 rows=1,858 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 114kB
55. 1.079 1.079 ↑ 1.0 1,858 1

Seq Scan on m_doctors doc (cost=0.00..50.58 rows=1,858 width=30) (actual time=0.010..1.079 rows=1,858 loops=1)

56. 0.077 0.077 ↑ 1.0 59 1

Hash (cost=1.59..1.59 rows=59 width=21) (actual time=0.077..0.077 rows=59 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 4kB
57. 0.000 0.039 ↑ 1.0 59 1

Seq Scan on m_department dept (cost=0.00..1.59 rows=59 width=21) (actual time=0.007..0.039 rows=59 loops=1)

58. 0.148 0.232 ↑ 1.0 201 1

Hash (cost=4.01..4.01 rows=201 width=25) (actual time=0.232..0.232 rows=201 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
59. 0.084 0.084 ↑ 1.0 201 1

Seq Scan on m_ward_names wn (cost=0.00..4.01 rows=201 width=25) (actual time=0.008..0.084 rows=201 loops=1)

60. 20.043 40.209 ↑ 1.0 44,504 1

Hash (cost=1,601.04..1,601.04 rows=44,504 width=47) (actual time=40.209..40.209 rows=44,504 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 3455kB
61. 20.166 20.166 ↑ 1.0 44,504 1

Seq Scan on m_insurance_plan_main ipm (cost=0.00..1,601.04 rows=44,504 width=47) (actual time=0.008..20.166 rows=44,504 loops=1)

62. 0.016 0.032 ↑ 1.0 33 1

Hash (cost=1.33..1.33 rows=33 width=4) (actual time=0.032..0.032 rows=33 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
63. 0.016 0.016 ↑ 1.0 33 1

Seq Scan on m_hospital_center_master hcm (cost=0.00..1.33 rows=33 width=4) (actual time=0.005..0.016 rows=33 loops=1)

64. 0.006 0.017 ↑ 1.0 15 1

Hash (cost=1.15..1.15 rows=15 width=27) (actual time=0.017..0.017 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
65. 0.011 0.011 ↑ 1.0 15 1

Seq Scan on m_encounter_type_codes etc (cost=0.00..1.15 rows=15 width=27) (actual time=0.004..0.011 rows=15 loops=1)

66. 0.005 0.010 ↑ 132.5 8 1

Hash (cost=20.60..20.60 rows=1,060 width=17) (actual time=0.010..0.010 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
67. 0.005 0.005 ↑ 132.5 8 1

Seq Scan on m_encounter_start_types est (cost=0.00..20.60 rows=1,060 width=17) (actual time=0.003..0.005 rows=8 loops=1)

68. 0.005 0.012 ↑ 117.5 8 1

Hash (cost=19.40..19.40 rows=940 width=28) (actual time=0.012..0.012 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
69. 0.007 0.007 ↑ 117.5 8 1

Seq Scan on m_encounter_end_types eet (cost=0.00..19.40 rows=940 width=28) (actual time=0.003..0.007 rows=8 loops=1)

70. 0.456 0.839 ↑ 1.0 954 1

Hash (cost=19.54..19.54 rows=954 width=34) (actual time=0.839..0.839 rows=954 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 63kB
71. 0.383 0.383 ↑ 1.0 954 1

Seq Scan on m_transfer_hospitals ths (cost=0.00..19.54 rows=954 width=34) (actual time=0.005..0.383 rows=954 loops=1)

72. 0.476 0.825 ↑ 1.0 954 1

Hash (cost=19.54..19.54 rows=954 width=34) (actual time=0.825..0.825 rows=954 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 63kB
73. 0.349 0.349 ↑ 1.0 954 1

Seq Scan on m_transfer_hospitals thd (cost=0.00..19.54 rows=954 width=34) (actual time=0.002..0.349 rows=954 loops=1)

74. 0.361 0.649 ↑ 1.0 710 1

Hash (cost=16.10..16.10 rows=710 width=32) (actual time=0.649..0.649 rows=710 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 46kB
75. 0.288 0.288 ↑ 1.0 710 1

Seq Scan on m_insurance_company_master picm (cost=0.00..16.10 rows=710 width=32) (actual time=0.006..0.288 rows=710 loops=1)

76. 0.367 0.634 ↑ 1.0 710 1

Hash (cost=16.10..16.10 rows=710 width=32) (actual time=0.634..0.634 rows=710 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 46kB
77. 0.267 0.267 ↑ 1.0 710 1

Seq Scan on m_insurance_company_master sicm (cost=0.00..16.10 rows=710 width=32) (actual time=0.002..0.267 rows=710 loops=1)

78. 0.304 0.577 ↑ 1.0 623 1

Hash (cost=18.23..18.23 rows=623 width=34) (actual time=0.577..0.577 rows=623 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 41kB
79. 0.273 0.273 ↑ 1.0 623 1

Seq Scan on m_tpa_master ptm (cost=0.00..18.23 rows=623 width=34) (actual time=0.005..0.273 rows=623 loops=1)

80. 0.282 0.518 ↑ 1.0 623 1

Hash (cost=18.23..18.23 rows=623 width=34) (actual time=0.518..0.518 rows=623 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 41kB
81. 0.236 0.236 ↑ 1.0 623 1

Seq Scan on m_tpa_master stm (cost=0.00..18.23 rows=623 width=34) (actual time=0.001..0.236 rows=623 loops=1)

82. 2.179 367.906 ↓ 19.5 2,784 1

Hash (cost=41,673.28..41,673.28 rows=143 width=127) (actual time=367.906..367.906 rows=2,784 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 429kB
83. 2.640 365.727 ↓ 19.5 2,784 1

Hash Left Join (cost=32,093.67..41,673.28 rows=143 width=127) (actual time=156.315..365.727 rows=2,784 loops=1)

  • Hash Cond: ((dc_2.head)::text = (ct_2.id)::text)
84. 66.270 362.802 ↓ 28.1 2,784 1

Nested Loop Left Join (cost=32,081.19..41,648.35 rows=99 width=93) (actual time=156.017..362.802 rows=2,784 loops=1)

  • Join Filter: ((md_1.dept_id)::text = (mdp_1.dept_id)::text)
  • Rows Removed by Join Filter: 161472
85. 4.407 243.636 ↓ 28.1 2,784 1

Nested Loop Left Join (cost=32,081.19..41,559.00 rows=99 width=88) (actual time=155.961..243.636 rows=2,784 loops=1)

86. 13.049 228.093 ↓ 28.1 2,784 1

Hash Join (cost=32,080.91..41,527.64 rows=99 width=66) (actual time=155.935..228.093 rows=2,784 loops=1)

  • Hash Cond: (dc_2.cross_consultation_ref_presc_id = pp_1.patient_presc_id)
87. 59.353 59.353 ↑ 1.0 13,741 1

Seq Scan on s_j_doctor_consultation dc_2 (cost=0.00..9,271.70 rows=13,923 width=31) (actual time=0.074..59.353 rows=13,741 loops=1)

  • Filter: (cross_consultation_ref_presc_id <> 0)
  • Rows Removed by Filter: 295202
88. 4.558 155.691 ↑ 1.0 8,229 1

Hash (cost=31,975.11..31,975.11 rows=8,464 width=43) (actual time=155.691..155.691 rows=8,229 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 611kB
89. 151.133 151.133 ↑ 1.0 8,229 1

Seq Scan on s_j_patient_prescription pp_1 (cost=0.00..31,975.11 rows=8,464 width=43) (actual time=0.016..151.133 rows=8,229 loops=1)

  • Filter: ((presc_type)::text = 'Doctor'::text)
  • Rows Removed by Filter: 1178340
90. 11.136 11.136 ↑ 1.0 1 2,784

Index Scan using idx_md_doctor_id on m_doctors md_1 (cost=0.28..0.31 rows=1 width=38) (actual time=0.004..0.004 rows=1 loops=2,784)

  • Index Cond: ((doctor_id)::text = (dc_2.doctor_name)::text)
91. 52.870 52.896 ↑ 1.0 59 2,784

Materialize (cost=0.00..1.88 rows=59 width=21) (actual time=0.000..0.019 rows=59 loops=2,784)

92. 0.026 0.026 ↑ 1.0 59 1

Seq Scan on m_department mdp_1 (cost=0.00..1.59 rows=59 width=21) (actual time=0.005..0.026 rows=59 loops=1)

93. 0.153 0.285 ↑ 1.0 288 1

Hash (cost=8.88..8.88 rows=288 width=41) (actual time=0.285..0.285 rows=288 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 22kB
94. 0.132 0.132 ↑ 1.0 288 1

Seq Scan on m_consultation_types ct_2 (cost=0.00..8.88 rows=288 width=41) (actual time=0.005..0.132 rows=288 loops=1)

95. 57.658 111.552 ↑ 1.0 107,253 1

Hash (cost=2,850.53..2,850.53 rows=107,253 width=73) (actual time=111.552..111.552 rows=107,253 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 11675kB
96. 53.894 53.894 ↑ 1.0 107,253 1

Seq Scan on s_j_scheduler_appointments sa (cost=0.00..2,850.53 rows=107,253 width=73) (actual time=0.006..53.894 rows=107,253 loops=1)

97. 0.120 0.256 ↑ 1.0 288 1

Hash (cost=8.88..8.88 rows=288 width=41) (actual time=0.256..0.256 rows=288 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 22kB
98. 0.136 0.136 ↑ 1.0 288 1

Seq Scan on m_consultation_types ct (cost=0.00..8.88 rows=288 width=41) (actual time=0.004..0.136 rows=288 loops=1)

99. 0.004 0.008 ↑ 326.0 5 1

Hash (cost=26.30..26.30 rows=1,630 width=20) (actual time=0.008..0.008 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
100. 0.004 0.004 ↑ 326.0 5 1

Seq Scan on m_op_type_names otn (cost=0.00..26.30 rows=1,630 width=20) (actual time=0.002..0.004 rows=5 loops=1)

101. 0.813 1.601 ↑ 1.0 1,858 1

Hash (cost=50.58..50.58 rows=1,858 width=30) (actual time=1.601..1.601 rows=1,858 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 114kB
102. 0.788 0.788 ↑ 1.0 1,858 1

Seq Scan on m_doctors drf (cost=0.00..50.58 rows=1,858 width=30) (actual time=0.006..0.788 rows=1,858 loops=1)

103. 59.804 116.665 ↑ 1.0 135,612 1

Hash (cost=3,349.12..3,349.12 rows=135,612 width=28) (actual time=116.665..116.665 rows=135,612 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 8086kB
104. 56.861 56.861 ↑ 1.0 135,612 1

Seq Scan on m_referral rf (cost=0.00..3,349.12 rows=135,612 width=28) (actual time=0.004..56.861 rows=135,612 loops=1)

105. 0.760 1.575 ↑ 1.0 1,595 1

Hash (cost=58.95..58.95 rows=1,595 width=40) (actual time=1.575..1.575 rows=1,595 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 113kB
106. 0.815 0.815 ↑ 1.0 1,595 1

Seq Scan on s_j_patient_admission_request par (cost=0.00..58.95 rows=1,595 width=40) (actual time=0.005..0.815 rows=1,595 loops=1)

107. 7.015 7.015 ↓ 0.0 0 305

Index Scan using idx_dc_patient_id on s_j_doctor_consultation (cost=0.42..0.51 rows=1 width=24) (actual time=0.022..0.023 rows=0 loops=305)

  • Index Cond: ((patient_id)::text = (pr.patient_id)::text)
  • Filter: ((doctor_name)::text = 'DOC0000'::text)
  • Rows Removed by Filter: 1
108. 10.370 10.370 ↑ 1.3 3 305

Index Scan using idx_mrd_visit_id on s_j_mrd_diagnosis mrd (cost=0.43..0.74 rows=4 width=57) (actual time=0.020..0.034 rows=3 loops=305)

  • Index Cond: ((visit_id)::text = (pr.patient_id)::text)
109. 1.000 1.000 ↓ 0.0 0 1,000

Index Scan using idx_md_doctor_id on m_doctors mpar (cost=0.28..0.40 rows=1 width=30) (actual time=0.001..0.001 rows=0 loops=1,000)

  • Index Cond: ((doctor_id)::text = (par.requesting_doc)::text)
110.          

SubPlan (forSeq Scan)

111. 40.000 40.000 ↑ 1.0 1 1,000

Index Scan using s_j_patient_details_pkey on s_j_patient_details pd_1 (cost=0.42..8.48 rows=1 width=8) (actual time=0.039..0.040 rows=1 loops=1,000)

  • Index Cond: ((mr_no)::text = (pr.mr_no)::text)
112. 139,512.930 330,960.000 ↑ 1.0 1 1,000

Hash Join (cost=9,914.28..20,262.57 rows=1 width=13) (actual time=201.618..330.960 rows=1 loops=1,000)

  • Hash Cond: (ppd.patient_policy_id = pip.patient_policy_id)
113. 132,160.070 132,160.070 ↑ 1.0 362,639 989

Seq Scan on s_j_patient_policy_details ppd (cost=0.00..8,988.39 rows=362,639 width=17) (actual time=0.005..133.630 rows=362,639 loops=989)

114. 5.000 59,287.000 ↑ 1.0 1 1,000

Hash (cost=9,914.26..9,914.26 rows=1 width=4) (actual time=59.287..59.287 rows=1 loops=1,000)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
  • Filter: ((priority = 1) AND ((pr.patient_id)::text = (patient_id)::text))
115. 59,282.000 59,282.000 ↑ 1.0 1 1,000

Seq Scan on s_j_patient_insurance_plans pip (cost=0.00..9,914.26 rows=1 width=4) (actual time=21.416..59.282 rows=1 loops=1,000)

  • Rows Removed by Filter: 362550
116. 12.996 42,888.000 ↓ 0.0 0 1,000

Hash Join (cost=9,914.28..20,262.57 rows=1 width=13) (actual time=42.888..42.888 rows=0 loops=1,000)

  • Hash Cond: (ppd_1.patient_policy_id = pip_1.patient_policy_id)
117. 0.004 0.004 ↑ 362,639.0 1 1

Seq Scan on s_j_patient_policy_details ppd_1 (cost=0.00..8,988.39 rows=362,639 width=17) (actual time=0.004..0.004 rows=1 loops=1)

118. 2.000 42,875.000 ↓ 0.0 0 1,000

Hash (cost=9,914.26..9,914.26 rows=1 width=4) (actual time=42.875..42.875 rows=0 loops=1,000)

  • Buckets: 1024 Batches: 1 Memory Usage: 0kB
119. 42,873.000 42,873.000 ↓ 0.0 0 1,000

Seq Scan on s_j_patient_insurance_plans pip_1 (cost=0.00..9,914.26 rows=1 width=4) (actual time=42.873..42.873 rows=0 loops=1,000)

  • Filter: ((priority = 2) AND ((pr.patient_id)::text = (patient_id)::text))
  • Rows Removed by Filter: 362551
120. 139,720.077 333,032.000 ↑ 1.0 1 1,000

Hash Join (cost=9,914.28..20,262.57 rows=1 width=8) (actual time=202.493..333.032 rows=1 loops=1,000)

  • Hash Cond: (ppd_2.patient_policy_id = pip_2.patient_policy_id)
121. 134,510.923 134,510.923 ↑ 1.0 362,639 989

Seq Scan on s_j_patient_policy_details ppd_2 (cost=0.00..8,988.39 rows=362,639 width=12) (actual time=0.005..136.007 rows=362,639 loops=989)

122. 6.000 58,801.000 ↑ 1.0 1 1,000

Hash (cost=9,914.26..9,914.26 rows=1 width=4) (actual time=58.801..58.801 rows=1 loops=1,000)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
123. 58,795.000 58,795.000 ↑ 1.0 1 1,000

Seq Scan on s_j_patient_insurance_plans pip_2 (cost=0.00..9,914.26 rows=1 width=4) (actual time=21.111..58.795 rows=1 loops=1,000)

  • Filter: ((priority = 1) AND ((pr.patient_id)::text = (patient_id)::text))
  • Rows Removed by Filter: 362550
124. 12.996 43,028.000 ↓ 0.0 0 1,000

Hash Join (cost=9,914.28..20,262.57 rows=1 width=8) (actual time=43.028..43.028 rows=0 loops=1,000)

  • Hash Cond: (ppd_3.patient_policy_id = pip_3.patient_policy_id)
125. 0.004 0.004 ↑ 362,639.0 1 1

Seq Scan on s_j_patient_policy_details ppd_3 (cost=0.00..8,988.39 rows=362,639 width=12) (actual time=0.004..0.004 rows=1 loops=1)

126. 2.000 43,015.000 ↓ 0.0 0 1,000

Hash (cost=9,914.26..9,914.26 rows=1 width=4) (actual time=43.015..43.015 rows=0 loops=1,000)

  • Buckets: 1024 Batches: 1 Memory Usage: 0kB
127. 43,013.000 43,013.000 ↓ 0.0 0 1,000

Seq Scan on s_j_patient_insurance_plans pip_3 (cost=0.00..9,914.26 rows=1 width=4) (actual time=43.013..43.013 rows=0 loops=1,000)

  • Filter: ((priority = 2) AND ((pr.patient_id)::text = (patient_id)::text))
  • Rows Removed by Filter: 362551
Planning time : 138.732 ms
Execution time : 760,081.483 ms