explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TKpS

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.192 ↑ 1.0 1 2

Nested Loop Left Join (cost=4,119.97..4,350.62 rows=1 width=160) (actual time=0.094..0.096 rows=1 loops=2)

  • Join Filter: ((bcn.bill_no)::text = (b.bill_no)::text)
  • Rows Removed by Join Filter: 10
  • Filter: ((SubPlan 4) > 0::numeric)
2. 0.002 0.086 ↑ 2.0 1 2

Nested Loop (cost=1.72..203.87 rows=2 width=48) (actual time=0.042..0.043 rows=1 loops=2)

3. 0.002 0.050 ↑ 6.0 1 2

Nested Loop (cost=1.29..156.93 rows=6 width=12) (actual time=0.024..0.025 rows=1 loops=2)

4. 0.004 0.030 ↑ 6.0 1 2

Nested Loop (cost=0.86..110.04 rows=6 width=13) (actual time=0.013..0.015 rows=1 loops=2)

5. 0.008 0.008 ↑ 6.0 1 2

Index Scan using tests_prescribed_report_idx on tests_prescribed tp_1 (cost=0.42..12.42 rows=6 width=8) (actual time=0.002..0.004 rows=1 loops=2)

  • Index Cond: (report_id = tv.report_id)
  • Filter: ((coll_prescribed_id IS NULL) AND (mr_no IS NOT NULL))
6. 0.018 0.018 ↑ 1.0 1 2

Index Scan using bac_activity_id_index on bill_activity_charge bac (cost=0.43..16.26 rows=1 width=16) (actual time=0.009..0.009 rows=1 loops=2)

  • Index Cond: ((activity_id)::text = ((tp_1.prescribed_id)::character varying)::text)
  • Filter: ((activity_code)::text = 'DIA'::text)
7. 0.018 0.018 ↑ 1.0 1 2

Index Scan using bill_charge_charge_id_idx on bill_charge bc (cost=0.43..7.80 rows=1 width=17) (actual time=0.009..0.009 rows=1 loops=2)

  • Index Cond: ((charge_id)::text = (bac.charge_id)::text)
8. 0.028 0.034 ↑ 1.0 1 2

Index Scan using bill_pkey on bill b (cost=0.43..7.81 rows=1 width=44) (actual time=0.016..0.017 rows=1 loops=2)

  • Index Cond: ((bill_no)::text = (bc.bill_no)::text)
  • Filter: ((visit_type = 'o'::bpchar) AND ((SubPlan 3) > 0::numeric))
9.          

SubPlan (forIndex Scan)

10. 0.006 0.006 ↑ 1.0 1 2

Result (cost=0.00..0.02 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=2)

11. 0.002 0.090 ↑ 20.0 10 2

Materialize (cost=4,118.25..4,123.25 rows=200 width=112) (actual time=0.044..0.045 rows=10 loops=2)

12. 0.013 0.088 ↑ 20.0 10 1

HashAggregate (cost=4,118.25..4,120.25 rows=200 width=58) (actual time=0.086..0.088 rows=10 loops=1)

13. 0.013 0.075 ↑ 33.3 15 1

Nested Loop Left Join (cost=0.43..4,114.50 rows=500 width=58) (actual time=0.009..0.075 rows=15 loops=1)

14. 0.002 0.002 ↑ 33.3 15 1

Seq Scan on bill_credit_notes bcn (cost=0.00..15.00 rows=500 width=96) (actual time=0.001..0.002 rows=15 loops=1)

15. 0.060 0.060 ↑ 1.0 1 15

Index Scan using bill_pkey on bill cn (cost=0.43..8.19 rows=1 width=18) (actual time=0.004..0.004 rows=1 loops=15)

  • Index Cond: ((bcn.credit_note_bill_no)::text = (bill_no)::text)
16. 0.006 0.006 ↑ 1.0 1 2

Index Only Scan using test_visit_reports_pkey on test_visit_reports tvr (cost=0.42..8.44 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=2)

  • Index Cond: (report_id = tv.report_id)
  • Heap Fetches: 2
17.          

SubPlan (forNested Loop Left Join)

18. 0.004 0.004 ↑ 1.0 1 2

Result (cost=0.00..0.04 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=2)

19. 0.004 0.004 ↑ 1.0 1 2

Result (cost=0.00..0.02 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=2)

20. 0.004 0.004 ↑ 1.0 1 2

Result (cost=0.00..0.04 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=2)