explain.depesz.com

PostgreSQL's explain analyze made readable

Result: W2O9

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

Limit (cost=1,755.05..3,491.58 rows=15 width=30) (actual time=3,199.707..3,200.800 rows=15 loops=1)

2. 0.040 3,200.796 ↑ 547.5 30 1

GroupAggregate (cost=18.52..1,901,517.86 rows=16,425 width=30) (actual time=1,951.700..3,200.796 rows=30 loops=1)

3. 184.650 3,200.756 ↑ 382.0 43 1

Nested Loop (cost=18.52..1,901,189.36 rows=16,425 width=30) (actual time=900.557..3,200.756 rows=43 loops=1)

4. 427.701 427.701 ↑ 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.019..427.701 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_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