explain.depesz.com

PostgreSQL's explain analyze made readable

Result: oX4M : changed

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 25,525.697 ↑ 1.7 12 1

Limit (cost=5,555,716.28..5,555,716.33 rows=20 width=344) (actual time=25,525.695..25,525.697 rows=12 loops=1)

2. 0.052 25,525.695 ↑ 7.7 12 1

Sort (cost=5,555,716.28..5,555,716.51 rows=92 width=344) (actual time=25,525.693..25,525.695 rows=12 loops=1)

  • Sort Key: psdal.log_id
  • Sort Method: quicksort Memory: 28kB
3. 0.017 25,525.643 ↑ 7.7 12 1

Append (cost=50.27..5,555,712.91 rows=92 width=86) (actual time=50.363..25,525.643 rows=12 loops=1)

4. 0.028 50.379 ↓ 3.0 3 1

Nested Loop (cost=50.27..62.32 rows=1 width=73) (actual time=50.362..50.379 rows=3 loops=1)

5. 0.077 50.027 ↓ 108.0 108 1

Bitmap Heap Scan on patient_section_details_audit_log psdal (cost=49.70..53.72 rows=1 width=77) (actual time=49.975..50.027 rows=108 loops=1)

  • Recheck Cond: ((section_item_id = 1207048) AND ((patient_id)::text = 'LCRCOP000804'::text))
  • Filter: ((mr_no)::text = 'LCRC00000207'::text)
6. 0.003 49.950 ↓ 0.0 0 1

BitmapAnd (cost=49.70..49.70 rows=1 width=0) (actual time=49.950..49.950 rows=0 loops=1)

7. 49.833 49.833 ↑ 7.6 108 1

Bitmap Index Scan on patient_section_details_audit_log_section_item_id_idx (cost=0.00..22.71 rows=820 width=0) (actual time=49.833..49.833 rows=108 loops=1)

  • Index Cond: (section_item_id = 1207048)
8. 0.114 0.114 ↑ 7.4 111 1

Bitmap Index Scan on patient_section_details_audit_log_patient_id_idx (cost=0.00..26.74 rows=823 width=0) (actual time=0.114..0.114 rows=111 loops=1)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
9. 0.324 0.324 ↓ 0.0 0 108

Index Scan using patient_section_details_pkey on patient_section_details psd (cost=0.56..8.59 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=108)

  • Index Cond: (section_detail_id = psdal.section_detail_id)
  • Filter: (section_id = (-7))
  • Rows Removed by Filter: 1
10. 0.004 5,030.972 ↑ 14.0 3 1

Subquery Scan on *SELECT* 2 (cost=181,233.22..504,329.28 rows=42 width=79) (actual time=5,005.416..5,030.972 rows=3 loops=1)

11. 43.270 5,030.968 ↑ 14.0 3 1

Hash Join (cost=181,233.22..504,328.86 rows=42 width=79) (actual time=5,005.413..5,030.968 rows=3 loops=1)

  • Hash Cond: (ppal.patient_presc_id = ptpal.op_test_pres_id)
12. 0.007 2,426.561 ↑ 2.9 9 1

Nested Loop (cost=0.43..311,636.38 rows=26 width=27) (actual time=96.209..2,426.561 rows=9 loops=1)

13. 0.075 0.075 ↑ 1.0 1 1

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc (cost=0.43..8.45 rows=1 width=23) (actual time=0.072..0.075 rows=1 loops=1)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
14. 2,426.479 2,426.479 ↑ 2.9 9 1

Seq Scan on patient_prescription_audit_log ppal (cost=0.00..311,627.67 rows=26 width=8) (actual time=96.134..2,426.479 rows=9 loops=1)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
  • Rows Removed by Filter: 10993774
15. 783.563 2,561.137 ↓ 1.0 1,182,090 1

Hash (cost=155,151.96..155,151.96 rows=1,171,347 width=56) (actual time=2,561.137..2,561.137 rows=1,182,090 loops=1)

  • Buckets: 4096 Batches: 64 Memory Usage: 1745kB
16. 1,777.574 1,777.574 ↓ 1.0 1,182,090 1

Seq Scan on patient_test_prescriptions_audit_log ptpal (cost=0.00..155,151.96 rows=1,171,347 width=56) (actual time=0.033..1,777.574 rows=1,182,090 loops=1)

  • Filter: (((operation)::text = 'INSERT'::text) AND ((field_name)::text = 'op_test_pres_id'::text))
  • Rows Removed by Filter: 4429723
17. 0.001 1,160.885 ↓ 0.0 0 1

Subquery Scan on *SELECT* 3 (cost=0.43..466,788.42 rows=1 width=79) (actual time=1,160.885..1,160.885 rows=0 loops=1)

18. 0.001 1,160.884 ↓ 0.0 0 1

Nested Loop (cost=0.43..466,788.41 rows=1 width=79) (actual time=1,160.884..1,160.884 rows=0 loops=1)

19. 0.001 1,160.883 ↓ 0.0 0 1

Nested Loop (cost=0.00..466,779.95 rows=1 width=60) (actual time=1,160.883..1,160.883 rows=0 loops=1)

  • Join Filter: (ptpal_1.op_test_pres_id = ppal_1.patient_presc_id)
20. 1,160.882 1,160.882 ↓ 0.0 0 1

Seq Scan on patient_test_prescriptions_audit_log ptpal_1 (cost=0.00..155,151.96 rows=1 width=56) (actual time=1,160.882..1,160.882 rows=0 loops=1)

  • Filter: (((operation)::text = 'ChangeLog'::text) AND ((field_name)::text = 'op_test_pres_id'::text))
  • Rows Removed by Filter: 5611813
21. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_prescription_audit_log ppal_1 (cost=0.00..311,627.67 rows=26 width=8) (never executed)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
22. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_1 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
23. 0.002 2,853.422 ↑ 7.0 1 1

Subquery Scan on *SELECT* 4 (cost=33,251.38..346,958.22 rows=7 width=86) (actual time=2,850.303..2,853.422 rows=1 loops=1)

24. 0.006 2,853.420 ↑ 7.0 1 1

Nested Loop (cost=33,251.38..346,958.15 rows=7 width=86) (actual time=2,850.301..2,853.420 rows=1 loops=1)

25. 0.035 0.035 ↑ 1.0 1 1

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_2 (cost=0.43..8.45 rows=1 width=23) (actual time=0.032..0.035 rows=1 loops=1)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
26. 16.847 2,853.379 ↑ 7.0 1 1

Hash Join (cost=33,250.95..346,949.63 rows=7 width=67) (actual time=2,850.264..2,853.379 rows=1 loops=1)

  • Hash Cond: (ppal_2.patient_presc_id = pspal.op_service_pres_id)
27. 2,357.660 2,357.660 ↑ 2.9 9 1

Seq Scan on patient_prescription_audit_log ppal_2 (cost=0.00..311,627.67 rows=26 width=8) (actual time=94.157..2,357.660 rows=9 loops=1)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
  • Rows Removed by Filter: 10993774
28. 94.952 478.872 ↓ 1.0 197,038 1

Hash (cost=28,786.10..28,786.10 rows=192,068 width=63) (actual time=478.872..478.872 rows=197,038 loops=1)

  • Buckets: 4096 Batches: 8 Memory Usage: 2425kB
29. 383.920 383.920 ↓ 1.0 197,038 1

Seq Scan on patient_service_prescriptions_audit_log pspal (cost=0.00..28,786.10 rows=192,068 width=63) (actual time=0.037..383.920 rows=197,038 loops=1)

  • Filter: (((operation)::text = 'INSERT'::text) AND ((field_name)::text = 'op_service_pres_id'::text))
  • Rows Removed by Filter: 837016
30. 0.000 198.102 ↓ 0.0 0 1

Subquery Scan on *SELECT* 5 (cost=0.43..340,422.56 rows=1 width=86) (actual time=198.102..198.102 rows=0 loops=1)

31. 0.000 198.102 ↓ 0.0 0 1

Nested Loop (cost=0.43..340,422.55 rows=1 width=86) (actual time=198.102..198.102 rows=0 loops=1)

32. 0.002 198.102 ↓ 0.0 0 1

Nested Loop (cost=0.00..340,414.09 rows=1 width=67) (actual time=198.102..198.102 rows=0 loops=1)

  • Join Filter: (pspal_1.op_service_pres_id = ppal_3.patient_presc_id)
33. 198.100 198.100 ↓ 0.0 0 1

Seq Scan on patient_service_prescriptions_audit_log pspal_1 (cost=0.00..28,786.10 rows=1 width=63) (actual time=198.100..198.100 rows=0 loops=1)

  • Filter: (((operation)::text = 'ChangeLog'::text) AND ((field_name)::text = 'op_service_pres_id'::text))
  • Rows Removed by Filter: 1034054
34. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_prescription_audit_log ppal_3 (cost=0.00..311,627.67 rows=26 width=8) (never executed)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
35. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_3 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
36. 0.002 2,517.693 ↓ 0.0 0 1

Subquery Scan on *SELECT* 6 (cost=11,445.05..324,932.09 rows=4 width=135) (actual time=2,517.693..2,517.693 rows=0 loops=1)

37. 0.005 2,517.691 ↓ 0.0 0 1

Nested Loop (cost=11,445.05..324,932.05 rows=4 width=135) (actual time=2,517.691..2,517.691 rows=0 loops=1)

38. 0.039 0.039 ↑ 1.0 1 1

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_4 (cost=0.43..8.45 rows=1 width=23) (actual time=0.035..0.039 rows=1 loops=1)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
39. 9.746 2,517.647 ↓ 0.0 0 1

Hash Join (cost=11,444.62..324,923.56 rows=4 width=116) (actual time=2,517.647..2,517.647 rows=0 loops=1)

  • Hash Cond: (ppal_4.patient_presc_id = pcpal.prescription_id)
40. 2,350.098 2,350.098 ↑ 2.9 9 1

Seq Scan on patient_prescription_audit_log ppal_4 (cost=0.00..311,627.67 rows=26 width=8) (actual time=93.334..2,350.098 rows=9 loops=1)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
  • Rows Removed by Filter: 10993774
41. 42.902 157.803 ↑ 1.0 111,103 1

Hash (cost=8,205.30..8,205.30 rows=111,306 width=112) (actual time=157.803..157.803 rows=111,103 loops=1)

  • Buckets: 4096 Batches: 8 Memory Usage: 1303kB
42. 114.901 114.901 ↑ 1.0 111,103 1

Seq Scan on patient_consultation_prescriptions_audit_log pcpal (cost=0.00..8,205.30 rows=111,306 width=112) (actual time=0.035..114.901 rows=111,103 loops=1)

  • Filter: (((operation)::text = 'INSERT'::text) AND ((field_name)::text = 'prescription_id'::text))
  • Rows Removed by Filter: 179439
43. 0.001 53.945 ↓ 0.0 0 1

Subquery Scan on *SELECT* 7 (cost=0.43..319,841.76 rows=1 width=135) (actual time=53.945..53.945 rows=0 loops=1)

44. 0.001 53.944 ↓ 0.0 0 1

Nested Loop (cost=0.43..319,841.75 rows=1 width=135) (actual time=53.944..53.944 rows=0 loops=1)

45. 0.001 53.943 ↓ 0.0 0 1

Nested Loop (cost=0.00..319,833.29 rows=1 width=116) (actual time=53.943..53.943 rows=0 loops=1)

  • Join Filter: (pcpal_1.prescription_id = ppal_5.patient_presc_id)
46. 53.942 53.942 ↓ 0.0 0 1

Seq Scan on patient_consultation_prescriptions_audit_log pcpal_1 (cost=0.00..8,205.30 rows=1 width=112) (actual time=53.942..53.942 rows=0 loops=1)

  • Filter: (((operation)::text = 'ChangeLog'::text) AND ((field_name)::text = 'prescription_id'::text))
  • Rows Removed by Filter: 290542
47. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_prescription_audit_log ppal_5 (cost=0.00..311,627.67 rows=26 width=8) (never executed)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
48. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_5 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
49. 0.001 2,338.822 ↓ 0.0 0 1

Subquery Scan on *SELECT* 8 (cost=0.43..311,644.15 rows=1 width=111) (actual time=2,338.822..2,338.822 rows=0 loops=1)

50. 0.001 2,338.821 ↓ 0.0 0 1

Nested Loop (cost=0.43..311,644.14 rows=1 width=111) (actual time=2,338.821..2,338.821 rows=0 loops=1)

51. 0.031 2,338.820 ↓ 0.0 0 1

Nested Loop (cost=0.00..311,635.68 rows=1 width=92) (actual time=2,338.820..2,338.820 rows=0 loops=1)

  • Join Filter: (popal.prescription_id = ppal_6.patient_presc_id)
  • Rows Removed by Join Filter: 144
52. 2,338.726 2,338.726 ↑ 2.9 9 1

Seq Scan on patient_prescription_audit_log ppal_6 (cost=0.00..311,627.67 rows=26 width=8) (actual time=93.636..2,338.726 rows=9 loops=1)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
  • Rows Removed by Filter: 10993774
53. 0.021 0.063 ↑ 1.0 16 9

Materialize (cost=0.00..1.81 rows=16 width=88) (actual time=0.004..0.007 rows=16 loops=9)

54. 0.042 0.042 ↑ 1.0 16 1

Seq Scan on patient_operation_prescriptions_audit_log popal (cost=0.00..1.73 rows=16 width=88) (actual time=0.028..0.042 rows=16 loops=1)

  • Filter: (((operation)::text = 'INSERT'::text) AND ((field_name)::text = 'prescription_id'::text))
  • Rows Removed by Filter: 33
55. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_6 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
56. 0.001 0.031 ↓ 0.0 0 1

Subquery Scan on *SELECT* 9 (cost=0.43..311,638.20 rows=1 width=111) (actual time=0.031..0.031 rows=0 loops=1)

57. 0.000 0.030 ↓ 0.0 0 1

Nested Loop (cost=0.43..311,638.19 rows=1 width=111) (actual time=0.030..0.030 rows=0 loops=1)

58. 0.002 0.030 ↓ 0.0 0 1

Nested Loop (cost=0.00..311,629.73 rows=1 width=92) (actual time=0.030..0.030 rows=0 loops=1)

  • Join Filter: (popal_1.prescription_id = ppal_7.patient_presc_id)
59. 0.028 0.028 ↓ 0.0 0 1

Seq Scan on patient_operation_prescriptions_audit_log popal_1 (cost=0.00..1.73 rows=1 width=88) (actual time=0.028..0.028 rows=0 loops=1)

  • Filter: (((operation)::text = 'ChangeLog'::text) AND ((field_name)::text = 'prescription_id'::text))
  • Rows Removed by Filter: 49
60. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_prescription_audit_log ppal_7 (cost=0.00..311,627.67 rows=26 width=8) (never executed)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
61. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_7 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
62. 0.001 2,352.671 ↓ 0.0 0 1

Subquery Scan on *SELECT* 10 (cost=0.43..311,709.27 rows=1 width=83) (actual time=2,352.671..2,352.671 rows=0 loops=1)

63. 0.001 2,352.670 ↓ 0.0 0 1

Nested Loop (cost=0.43..311,709.26 rows=1 width=83) (actual time=2,352.670..2,352.670 rows=0 loops=1)

  • Join Filter: (popal_2.prescription_id = pop.prescription_id)
64. 0.000 2,352.669 ↓ 0.0 0 1

Nested Loop (cost=0.43..311,692.72 rows=1 width=86) (actual time=2,352.669..2,352.669 rows=0 loops=1)

65. 0.146 2,352.669 ↓ 0.0 0 1

Nested Loop (cost=0.00..311,684.26 rows=1 width=67) (actual time=2,352.669..2,352.669 rows=0 loops=1)

  • Join Filter: (popal_2.prescription_id = ppal_8.patient_presc_id)
  • Rows Removed by Join Filter: 810
66. 0.283 0.283 ↑ 1.0 90 1

Seq Scan on patient_other_prescriptions_audit_log popal_2 (cost=0.00..21.42 rows=90 width=59) (actual time=0.025..0.283 rows=90 loops=1)

  • Filter: (((operation)::text = 'INSERT'::text) AND ((field_name)::text = 'prescription_id'::text))
  • Rows Removed by Filter: 605
67. 0.026 2,352.240 ↑ 2.9 9 90

Materialize (cost=0.00..311,627.80 rows=26 width=8) (actual time=1.029..26.136 rows=9 loops=90)

68. 2,352.214 2,352.214 ↑ 2.9 9 1

Seq Scan on patient_prescription_audit_log ppal_8 (cost=0.00..311,627.67 rows=26 width=8) (actual time=92.568..2,352.214 rows=9 loops=1)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
  • Rows Removed by Filter: 10993774
69. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_8 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
70. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_other_prescriptions pop (cost=0.00..11.24 rows=424 width=5) (never executed)

71. 0.001 0.137 ↓ 0.0 0 1

Subquery Scan on *SELECT* 11 (cost=0.43..311,674.43 rows=1 width=83) (actual time=0.137..0.137 rows=0 loops=1)

72. 0.000 0.136 ↓ 0.0 0 1

Nested Loop (cost=0.43..311,674.42 rows=1 width=83) (actual time=0.136..0.136 rows=0 loops=1)

  • Join Filter: (popal_3.prescription_id = pop_1.prescription_id)
73. 0.001 0.136 ↓ 0.0 0 1

Nested Loop (cost=0.43..311,657.88 rows=1 width=86) (actual time=0.136..0.136 rows=0 loops=1)

74. 0.001 0.135 ↓ 0.0 0 1

Nested Loop (cost=0.00..311,649.42 rows=1 width=67) (actual time=0.135..0.135 rows=0 loops=1)

  • Join Filter: (popal_3.prescription_id = ppal_9.patient_presc_id)
75. 0.134 0.134 ↓ 0.0 0 1

Seq Scan on patient_other_prescriptions_audit_log popal_3 (cost=0.00..21.42 rows=1 width=59) (actual time=0.134..0.134 rows=0 loops=1)

  • Filter: (((operation)::text = 'ChangeLog'::text) AND ((field_name)::text = 'prescription_id'::text))
  • Rows Removed by Filter: 695
76. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_prescription_audit_log ppal_9 (cost=0.00..311,627.67 rows=26 width=8) (never executed)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
77. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_9 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
78. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_other_prescriptions pop_1 (cost=0.00..11.24 rows=424 width=5) (never executed)

79. 0.000 0.001 ↓ 0.0 0 1

Subquery Scan on *SELECT* 12 (cost=0.43..311,649.31 rows=1 width=203) (actual time=0.001..0.001 rows=0 loops=1)

80. 0.000 0.001 ↓ 0.0 0 1

Nested Loop (cost=0.43..311,649.30 rows=1 width=203) (actual time=0.001..0.001 rows=0 loops=1)

81. 0.001 0.001 ↓ 0.0 0 1

Nested Loop (cost=0.00..311,640.84 rows=1 width=184) (actual time=0.001..0.001 rows=0 loops=1)

  • Join Filter: (pompal.prescription_id = ppal_10.patient_presc_id)
82. 0.000 0.000 ↓ 0.0 0 1

Seq Scan on patient_other_medicine_prescriptions_audit_log pompal (cost=0.00..12.85 rows=1 width=180) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: (((operation)::text = 'INSERT'::text) AND ((field_name)::text = 'prescription_id'::text))
83. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_prescription_audit_log ppal_10 (cost=0.00..311,627.67 rows=26 width=8) (never executed)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
84. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_10 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
85. 0.001 0.002 ↓ 0.0 0 1

Subquery Scan on *SELECT* 13 (cost=0.43..311,649.31 rows=1 width=203) (actual time=0.002..0.002 rows=0 loops=1)

86. 0.000 0.001 ↓ 0.0 0 1

Nested Loop (cost=0.43..311,649.30 rows=1 width=203) (actual time=0.001..0.001 rows=0 loops=1)

87. 0.001 0.001 ↓ 0.0 0 1

Nested Loop (cost=0.00..311,640.84 rows=1 width=184) (actual time=0.001..0.001 rows=0 loops=1)

  • Join Filter: (pompal_1.prescription_id = ppal_11.patient_presc_id)
88. 0.000 0.000 ↓ 0.0 0 1

Seq Scan on patient_other_medicine_prescriptions_audit_log pompal_1 (cost=0.00..12.85 rows=1 width=180) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: (((operation)::text = 'ChangeLog'::text) AND ((field_name)::text = 'prescription_id'::text))
89. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_prescription_audit_log ppal_11 (cost=0.00..311,627.67 rows=26 width=8) (never executed)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
90. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_11 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
91. 0.001 6,186.182 ↑ 5.6 5 1

Subquery Scan on *SELECT* 14 (cost=311,636.70..705,266.95 rows=28 width=79) (actual time=4,115.296..6,186.182 rows=5 loops=1)

92. 89.353 6,186.181 ↑ 5.6 5 1

Hash Join (cost=311,636.70..705,266.67 rows=28 width=79) (actual time=4,115.295..6,186.181 rows=5 loops=1)

  • Hash Cond: (pmpal.op_medicine_pres_id = ppal_12.patient_presc_id)
93. 3,745.877 3,745.877 ↓ 1.1 855,811 1

Seq Scan on patient_medicine_prescriptions_audit_log pmpal (cost=0.00..365,510.20 rows=803,414 width=56) (actual time=0.019..3,745.877 rows=855,811 loops=1)

  • Filter: (((operation)::text = 'INSERT'::text) AND ((field_name)::text = 'op_medicine_pres_id'::text))
  • Rows Removed by Filter: 12658622
94. 0.007 2,350.951 ↑ 2.9 9 1

Hash (cost=311,636.38..311,636.38 rows=26 width=27) (actual time=2,350.951..2,350.951 rows=9 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
95. 0.008 2,350.944 ↑ 2.9 9 1

Nested Loop (cost=0.43..311,636.38 rows=26 width=27) (actual time=93.674..2,350.944 rows=9 loops=1)

96. 0.031 0.031 ↑ 1.0 1 1

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_12 (cost=0.43..8.45 rows=1 width=23) (actual time=0.027..0.031 rows=1 loops=1)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
97. 2,350.905 2,350.905 ↑ 2.9 9 1

Seq Scan on patient_prescription_audit_log ppal_12 (cost=0.00..311,627.67 rows=26 width=8) (actual time=93.642..2,350.905 rows=9 loops=1)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
  • Rows Removed by Filter: 10993774
98. 0.000 2,782.382 ↓ 0.0 0 1

Subquery Scan on *SELECT* 15 (cost=0.43..677,146.66 rows=1 width=79) (actual time=2,782.382..2,782.382 rows=0 loops=1)

99. 0.001 2,782.382 ↓ 0.0 0 1

Nested Loop (cost=0.43..677,146.65 rows=1 width=79) (actual time=2,782.382..2,782.382 rows=0 loops=1)

100. 0.001 2,782.381 ↓ 0.0 0 1

Nested Loop (cost=0.00..677,138.19 rows=1 width=60) (actual time=2,782.381..2,782.381 rows=0 loops=1)

  • Join Filter: (pmpal_1.op_medicine_pres_id = ppal_13.patient_presc_id)
101. 2,782.380 2,782.380 ↓ 0.0 0 1

Seq Scan on patient_medicine_prescriptions_audit_log pmpal_1 (cost=0.00..365,510.20 rows=1 width=56) (actual time=2,782.380..2,782.380 rows=0 loops=1)

  • Filter: (((operation)::text = 'ChangeLog'::text) AND ((field_name)::text = 'op_medicine_pres_id'::text))
  • Rows Removed by Filter: 13514433
102. 0.000 0.000 ↓ 0.0 0

Seq Scan on patient_prescription_audit_log ppal_13 (cost=0.00..311,627.67 rows=26 width=8) (never executed)

  • Filter: (((field_name)::text = 'consultation_id'::text) AND (consultation_id = 1207048))
103. 0.000 0.000 ↓ 0.0 0

Index Scan using doctor_consultation_patient_id_idx on doctor_consultation dc_13 (cost=0.43..8.45 rows=1 width=23) (never executed)

  • Index Cond: ((patient_id)::text = 'LCRCOP000804'::text)
  • Filter: ((consultation_id = 1207048) AND ((mr_no)::text = 'LCRC00000207'::text))
Total runtime : 25,526.694 ms