explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3RDs

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 3,404.426 ↑ 1.0 15 1

Limit (cost=1,755.06..3,491.59 rows=15 width=30) (actual time=3,403.316..3,404.426 rows=15 loops=1)

2. 0.041 3,404.418 ↑ 547.5 30 1

GroupAggregate (cost=18.52..1,901,527.76 rows=16,425 width=30) (actual time=2,147.656..3,404.418 rows=30 loops=1)

3. 0.000 3,404.377 ↑ 382.0 43 1

Nested Loop (cost=18.52..1,901,199.26 rows=16,425 width=30) (actual time=935.943..3,404.377 rows=43 loops=1)

4. 446.789 446.789 ↑ 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.020..446.789 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. 3,106.086 3,106.086 ↓ 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.006..0.006 rows=0 loops=517,681)

  • Index Cond: ((mr_no)::text = (pd.mr_no)::text)
  • Filter: ((visit_type = 'o'::bpchar) AND (center_id = 7))
  • Rows Removed by Filter: 0