explain.depesz.com

PostgreSQL's explain analyze made readable

Result: fjPu

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 3,020.764 ↑ 1.0 15 1

Limit (cost=2,013.21..4,025.56 rows=15 width=30) (actual time=3,019.699..3,020.764 rows=15 loops=1)

2. 0.043 3,020.760 ↑ 512.5 30 1

GroupAggregate (cost=0.86..2,062,791.52 rows=15,376 width=30) (actual time=1,847.818..3,020.760 rows=30 loops=1)

3. 0.018 3,020.717 ↑ 357.6 43 1

Nested Loop Left Join (cost=0.86..2,062,484.00 rows=15,376 width=30) (actual time=833.768..3,020.717 rows=43 loops=1)

  • Join Filter: ((pd.mr_no)::text = (uma.mr_no)::text)
  • Filter: ((pd.patient_group = 0) OR ((uma.emp_username)::text = current_setting('application.username'::text)))
4. 194.604 3,020.656 ↑ 357.6 43 1

Nested Loop (cost=0.86..1,885,989.58 rows=15,376 width=34) (actual time=833.744..3,020.656 rows=43 loops=1)

5. 237.647 237.647 ↑ 5.9 517,681 1

Index Scan Backward using patient_details_mr_no_original_mr_no_coalesce_idx on patient_details pd (cost=0.43..159,939.80 rows=3,029,932 width=22) (actual time=0.015..237.647 rows=517,681 loops=1)

6. 2,588.405 2,588.405 ↓ 0.0 0 517,681

Index Scan using patient_registration_mr_no_index on patient_registration pr (cost=0.43..0.56 rows=1 width=27) (actual time=0.005..0.005 rows=0 loops=517,681)

  • Index Cond: ((mr_no)::text = (pd.mr_no)::text)
  • Filter: ((patient_id IS NOT NULL) AND (visit_type = 'o'::bpchar) AND (center_id = 7))
  • Rows Removed by Filter: 0
7. 0.042 0.043 ↓ 0.0 0 43

Materialize (cost=0.00..17.65 rows=510 width=126) (actual time=0.001..0.001 rows=0 loops=43)

8. 0.001 0.001 ↓ 0.0 0 1

Seq Scan on user_mrno_association uma (cost=0.00..15.10 rows=510 width=126) (actual time=0.001..0.001 rows=0 loops=1)