explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wVfF

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 3,104.312 ↑ 1.0 15 1

Limit (cost=2,004.88..3,991.12 rows=15 width=30) (actual time=3,103.419..3,104.312 rows=15 loops=1)

2. 0.038 3,104.306 ↑ 547.5 30 1

GroupAggregate (cost=18.64..2,174,949.87 rows=16,425 width=30) (actual time=1,986.655..3,104.306 rows=30 loops=1)

3. 101.607 3,104.268 ↑ 382.0 43 1

Nested Loop (cost=18.64..2,174,621.37 rows=16,425 width=30) (actual time=931.599..3,104.268 rows=43 loops=1)

4. 414.256 414.256 ↑ 5.9 517,681 1

Index Scan Backward using patient_details_mr_no_original_mr_no_coalesce_idx on patient_details pd (cost=18.09..175,059.28 rows=3,030,023 width=18) (actual time=0.025..414.256 rows=517,681 loops=1)

  • Filter: ((patient_group = 0) OR (hashed SubPlan 1))
5.          

SubPlan (for Index Scan Backward)

6. 0.000 0.000 ↓ 0.0 0

Seq Scan on user_mrno_association (cost=0.00..17.65 rows=3 width=48) (never executed)

  • Filter: ((emp_username)::text = current_setting('application.username'::text))
7. 2,588.405 2,588.405 ↓ 0.0 0 517,681

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

  • Index Cond: (((mr_no)::text = (pd.mr_no)::text) AND (visit_type = 'o'::bpchar) AND (center_id = 7))