explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KDgk

Settings
# exclusive inclusive rows x rows loops node
1. 0.137 0.441 ↑ 20.0 3 1

Nested Loop Left Join (cost=7.10..110.82 rows=60 width=241) (actual time=0.176..0.441 rows=3 loops=1)

  • Join Filter: CASE WHEN (tp.package_ref IS NULL) THEN ((pm.package_id)::text = (tp.test_id)::text) ELSE (pm.package_id = pp.package_id) END
  • Rows Removed by Join Filter: 408
  • Filter: ((NOT pm.multi_visit_package) OR (pm.multi_visit_package IS NULL))
2. 0.006 0.232 ↓ 3.0 3 1

Nested Loop Left Join (cost=7.10..104.11 rows=1 width=240) (actual time=0.098..0.232 rows=3 loops=1)

3. 0.005 0.226 ↓ 3.0 3 1

Nested Loop Left Join (cost=6.82..95.80 rows=1 width=232) (actual time=0.096..0.226 rows=3 loops=1)

4. 0.003 0.194 ↓ 3.0 3 1

Nested Loop Left Join (cost=6.40..93.47 rows=1 width=219) (actual time=0.084..0.194 rows=3 loops=1)

5. 0.006 0.173 ↓ 3.0 3 1

Nested Loop Left Join (cost=6.13..91.70 rows=1 width=199) (actual time=0.076..0.173 rows=3 loops=1)

6. 0.004 0.146 ↓ 3.0 3 1

Nested Loop Left Join (cost=5.71..88.79 rows=1 width=157) (actual time=0.067..0.146 rows=3 loops=1)

7. 0.005 0.136 ↓ 3.0 3 1

Nested Loop (cost=5.44..80.49 rows=1 width=143) (actual time=0.063..0.136 rows=3 loops=1)

8. 0.006 0.119 ↓ 3.0 3 1

Nested Loop Left Join (cost=5.30..80.31 rows=1 width=117) (actual time=0.057..0.119 rows=3 loops=1)

  • Join Filter: ((prev_tp.prescribed_id)::numeric = tp.reference_pres)
  • Rows Removed by Join Filter: 9
9. 0.005 0.089 ↓ 3.0 3 1

Nested Loop (cost=5.01..62.74 rows=1 width=113) (actual time=0.045..0.089 rows=3 loops=1)

10. 0.007 0.066 ↓ 3.0 3 1

Nested Loop (cost=4.73..54.43 rows=1 width=76) (actual time=0.037..0.066 rows=3 loops=1)

11. 0.017 0.017 ↑ 1.0 3 1

Index Scan using pat_id_index on tests_prescribed tp (cost=0.29..17.51 rows=3 width=67) (actual time=0.015..0.017 rows=3 loops=1)

  • Index Cond: ((pat_id)::text = 'OP121471'::text)
  • Filter: (package_ref IS NULL)
12. 0.015 0.042 ↑ 1.0 1 3

Bitmap Heap Scan on bill_activity_charge bac (cost=4.44..12.30 rows=1 width=15) (actual time=0.014..0.014 rows=1 loops=3)

  • Recheck Cond: ((activity_id)::text = (tp.prescribed_id)::text)
  • Filter: ((activity_code)::text = 'DIA'::text)
  • Rows Removed by Filter: 1
13. 0.027 0.027 ↑ 1.0 2 3

Bitmap Index Scan on bac_activity_id_index (cost=0.00..4.44 rows=2 width=0) (actual time=0.009..0.009 rows=2 loops=3)

  • Index Cond: ((activity_id)::text = (tp.prescribed_id)::text)
14. 0.018 0.018 ↑ 1.0 1 3

Index Scan using diagnostics_pkey on diagnostics d (cost=0.28..8.30 rows=1 width=45) (actual time=0.005..0.006 rows=1 loops=3)

  • Index Cond: ((test_id)::text = (tp.test_id)::text)
15. 0.024 0.024 ↑ 1.3 3 3

Index Scan using pat_id_index on tests_prescribed prev_tp (cost=0.29..17.51 rows=4 width=8) (actual time=0.007..0.008 rows=3 loops=3)

  • Index Cond: ((pat_id)::text = 'OP121471'::text)
16. 0.012 0.012 ↑ 1.0 1 3

Index Scan using diagnostics_departments_pkey on diagnostics_departments ddept (cost=0.14..0.17 rows=1 width=36) (actual time=0.004..0.004 rows=1 loops=3)

  • Index Cond: ((ddept_id)::text = (d.ddept_id)::text)
17. 0.006 0.006 ↓ 0.0 0 3

Index Scan using doctors_pkey on doctors pd (cost=0.27..8.29 rows=1 width=21) (actual time=0.002..0.002 rows=0 loops=3)

  • Index Cond: ((tp.pres_doctor)::text = (doctor_id)::text)
18. 0.021 0.021 ↑ 1.0 1 3

Index Scan using bill_charge_charge_id_idx on bill_charge bc (cost=0.42..2.90 rows=1 width=51) (actual time=0.007..0.007 rows=1 loops=3)

  • Index Cond: ((bac.charge_id)::text = (charge_id)::text)
19. 0.018 0.018 ↑ 1.0 1 3

Index Scan using doctors_pkey on doctors dc (cost=0.27..1.75 rows=1 width=21) (actual time=0.005..0.006 rows=1 loops=3)

  • Index Cond: ((doctor_id)::text = (bc.payee_doctor_id)::text)
20. 0.027 0.027 ↑ 1.0 1 3

Index Scan using bill_pkey on bill b (cost=0.42..2.33 rows=1 width=23) (actual time=0.009..0.009 rows=1 loops=3)

  • Index Cond: ((bc.bill_no)::text = (bill_no)::text)
21. 0.000 0.000 ↓ 0.0 0 3

Index Scan using package_prescribed_pkey on package_prescribed pp (cost=0.28..8.29 rows=1 width=12) (actual time=0.000..0.000 rows=0 loops=3)

  • Index Cond: (prescription_id = tp.package_ref)
22. 0.072 0.072 ↑ 1.0 136 3

Seq Scan on pack_master pm (cost=0.00..3.37 rows=137 width=5) (actual time=0.002..0.024 rows=136 loops=3)