explain.depesz.com

PostgreSQL's explain analyze made readable

Result: oQmA

Settings
# exclusive inclusive rows x rows loops node
1. 0.031 2,039.913 ↑ 5.0 1 1

Sort (cost=5,957.97..5,957.98 rows=5 width=458) (actual time=2,039.912..2,039.913 rows=1 loops=1)

  • Sort Key: psfv.field_display_order, psfv.option_display_order
  • Sort Method: quicksort Memory: 25kB
2. 0.002 2,039.882 ↑ 5.0 1 1

Subquery Scan on psfv (cost=5,957.30..5,957.91 rows=5 width=458) (actual time=2,039.882..2,039.882 rows=1 loops=1)

3. 0.001 2,039.880 ↑ 5.0 1 1

Unique (cost=5,957.30..5,957.76 rows=5 width=1,178) (actual time=2,039.879..2,039.880 rows=1 loops=1)

4. 0.098 2,039.879 ↑ 5.0 1 1

Sort (cost=5,957.30..5,957.31 rows=5 width=1,178) (actual time=2,039.879..2,039.879 rows=1 loops=1)

  • Sort Key: "*SELECT* 1".mr_no, "*SELECT* 1".patient_id, "*SELECT* 1".section_item_id, "*SELECT* 1".lableforyes, "*SELECT* 1".lableforno, "*SELECT* 1".generic_form_id, "*SELECT* 1".section_status, "*SELECT* 1".section_id, "*SELECT* 1".form_id, "*SELECT* 1".item_type, "*SELECT* 1".form_type, "*SELECT* 1".section_detail_id, "*SELECT* 1".finalized, "*SELECT* 1".finalized_user, "*SELECT* 1".linked_to, "*SELECT* 1".field_id, "*SELECT* 1".option_id, "*SELECT* 1".option_value, "*SELECT* 1".option_remarks, "*SELECT* 1".date_time, "*SELECT* 1".option_display_order, "*SELECT* 1".field_name, "*SELECT* 1".field_type, "*SELECT* 1".allow_others, "*SELECT* 1".allow_normal, "*SELECT* 1".normal_text, "*SELECT* 1".section_title, "*SELECT* 1".field_display_order, ((0)::numeric), ((0)::numeric), (0), (''::character varying), "*SELECT* 1".available, "*SELECT* 1".temp_username, "*SELECT* 1".allow_negative, (''::text)
  • Sort Method: quicksort Memory: 25kB
5. 0.002 2,039.781 ↑ 5.0 1 1

Append (cost=2,544.92..5,957.24 rows=5 width=1,178) (actual time=1,908.578..2,039.781 rows=1 loops=1)

6. 0.003 1,908.582 ↑ 4.0 1 1

Subquery Scan on *SELECT* 1 (cost=2,544.92..3,398.11 rows=4 width=343) (actual time=1,908.577..1,908.582 rows=1 loops=1)

7. 0.004 1,908.579 ↑ 4.0 1 1

Nested Loop Left Join (cost=2,544.92..3,397.97 rows=4 width=287) (actual time=1,908.574..1,908.579 rows=1 loops=1)

8. 0.004 1,908.548 ↑ 4.0 1 1

Nested Loop (cost=2,544.64..3,391.91 rows=4 width=192) (actual time=1,908.544..1,908.548 rows=1 loops=1)

9. 0.011 1,908.517 ↑ 4.0 1 1

Nested Loop (cost=2,544.35..3,385.88 rows=4 width=154) (actual time=1,908.513..1,908.517 rows=1 loops=1)

  • Join Filter: (psd.section_detail_id = v.section_detail_id)
10. 0.002 1,907.375 ↑ 1.0 1 1

Nested Loop Left Join (cost=2,543.78..2,557.99 rows=1 width=133) (actual time=1,907.373..1,907.375 rows=1 loops=1)

11. 0.003 1,907.372 ↑ 1.0 1 1

Nested Loop (cost=2,543.49..2,553.67 rows=1 width=114) (actual time=1,907.369..1,907.372 rows=1 loops=1)

12. 0.007 1,907.333 ↑ 1.0 1 1

Nested Loop (cost=2,543.22..2,549.32 rows=1 width=80) (actual time=1,907.331..1,907.333 rows=1 loops=1)

13. 0.095 1,905.824 ↑ 1.0 1 1

Bitmap Heap Scan on patient_section_details psd (cost=2,542.65..2,544.68 rows=1 width=63) (actual time=1,905.823..1,905.824 rows=1 loops=1)

  • Recheck Cond: (((mr_no)::text = 'UA1300000061540'::text) AND (section_id = 268))
  • Filter: (section_status = 'A'::bpchar)
  • Rows Removed by Filter: 6
  • Heap Blocks: exact=6
14. 6.146 1,905.729 ↓ 0.0 0 1

BitmapAnd (cost=2,542.65..2,542.65 rows=1 width=0) (actual time=1,905.729..1,905.729 rows=0 loops=1)

15. 0.193 0.193 ↑ 2.8 610 1

Bitmap Index Scan on patient_section_details_mr_no_idx (cost=0.00..33.23 rows=1,688 width=0) (actual time=0.193..0.193 rows=610 loops=1)

  • Index Cond: ((mr_no)::text = 'UA1300000061540'::text)
16. 1,899.390 1,899.390 ↓ 5.0 630,823 1

Bitmap Index Scan on psd_section_id_idx (cost=0.00..2,509.16 rows=125,146 width=0) (actual time=1,899.390..1,899.390 rows=630,823 loops=1)

  • Index Cond: (section_id = 268)
17. 1.502 1.502 ↑ 1.0 1 1

Index Scan using psf_section_detail_id_idx on patient_section_forms psf (cost=0.57..4.61 rows=1 width=17) (actual time=1.501..1.502 rows=1 loops=1)

  • Index Cond: (section_detail_id = psd.section_detail_id)
18. 0.036 0.036 ↑ 1.0 1 1

Index Scan using physician_form_desc_pkey on section_master sm (cost=0.28..4.32 rows=1 width=38) (actual time=0.036..0.036 rows=1 loops=1)

  • Index Cond: (section_id = 268)
  • Filter: ((linked_to)::text = 'patient'::text)
19. 0.001 0.001 ↓ 0.0 0 1

Index Scan using u_user_pk on u_user usr (cost=0.29..4.32 rows=1 width=27) (actual time=0.001..0.001 rows=0 loops=1)

  • Index Cond: ((psd.finalized_user)::text = (emp_username)::text)
20. 1.131 1.131 ↑ 7,865.0 1 1

Index Scan using ppfv_form_detail_id on patient_section_values v (cost=0.57..572.27 rows=7,865 width=29) (actual time=1.130..1.131 rows=1 loops=1)

  • Index Cond: (section_detail_id = psf.section_detail_id)
  • Filter: (available = 'Y'::bpchar)
21. 0.027 0.027 ↑ 1.0 1 1

Index Scan using sfd_field_id_idx on section_field_desc sfd (cost=0.28..1.51 rows=1 width=42) (actual time=0.027..0.027 rows=1 loops=1)

  • Index Cond: (field_id = v.field_id)
22. 0.027 0.027 ↓ 0.0 0 1

Index Scan using physician_form_field_options_pkey on section_field_options o (cost=0.29..1.52 rows=1 width=23) (actual time=0.027..0.027 rows=0 loops=1)

  • Index Cond: (v.option_id = option_id)
23. 0.000 131.197 ↓ 0.0 0 1

Nested Loop Left Join (cost=2,544.49..2,559.11 rows=1 width=272) (actual time=131.197..131.197 rows=0 loops=1)

24. 0.001 131.197 ↓ 0.0 0 1

Nested Loop (cost=2,544.21..2,554.78 rows=1 width=173) (actual time=131.196..131.197 rows=0 loops=1)

25. 0.001 131.196 ↓ 0.0 0 1

Nested Loop (cost=2,543.93..2,554.46 rows=1 width=135) (actual time=131.196..131.196 rows=0 loops=1)

26. 0.002 131.195 ↓ 0.0 0 1

Nested Loop (cost=2,543.65..2,550.12 rows=1 width=101) (actual time=131.195..131.195 rows=0 loops=1)

  • Join Filter: (psd_1.section_detail_id = img.section_detail_id)
27. 0.003 130.473 ↑ 1.0 1 1

Nested Loop (cost=2,543.22..2,549.32 rows=1 width=80) (actual time=130.472..130.473 rows=1 loops=1)

28. 0.022 130.454 ↑ 1.0 1 1

Bitmap Heap Scan on patient_section_details psd_1 (cost=2,542.65..2,544.68 rows=1 width=63) (actual time=130.454..130.454 rows=1 loops=1)

  • Recheck Cond: (((mr_no)::text = 'UA1300000061540'::text) AND (section_id = 268))
  • Filter: (section_status = 'A'::bpchar)
  • Rows Removed by Filter: 6
  • Heap Blocks: exact=6
29. 2.356 130.432 ↓ 0.0 0 1

BitmapAnd (cost=2,542.65..2,542.65 rows=1 width=0) (actual time=130.431..130.432 rows=0 loops=1)

30. 0.087 0.087 ↑ 2.8 610 1

Bitmap Index Scan on patient_section_details_mr_no_idx (cost=0.00..33.23 rows=1,688 width=0) (actual time=0.087..0.087 rows=610 loops=1)

  • Index Cond: ((mr_no)::text = 'UA1300000061540'::text)
31. 127.989 127.989 ↓ 5.0 630,823 1

Bitmap Index Scan on psd_section_id_idx (cost=0.00..2,509.16 rows=125,146 width=0) (actual time=127.989..127.989 rows=630,823 loops=1)

  • Index Cond: (section_id = 268)
32. 0.016 0.016 ↑ 1.0 1 1

Index Scan using psf_section_detail_id_idx on patient_section_forms psf_1 (cost=0.57..4.61 rows=1 width=17) (actual time=0.015..0.016 rows=1 loops=1)

  • Index Cond: (section_detail_id = psd_1.section_detail_id)
33. 0.720 0.720 ↓ 0.0 0 1

Index Scan using ppfg_form_detail_id on patient_section_image_details img (cost=0.43..0.63 rows=5 width=29) (actual time=0.720..0.720 rows=0 loops=1)

  • Index Cond: (section_detail_id = psf_1.section_detail_id)
  • Filter: (available = 'Y'::bpchar)
34. 0.000 0.000 ↓ 0.0 0

Index Scan using physician_form_desc_pkey on section_master sm_1 (cost=0.28..4.32 rows=1 width=38) (never executed)

  • Index Cond: (section_id = 268)
  • Filter: ((linked_to)::text = 'patient'::text)
35. 0.000 0.000 ↓ 0.0 0

Index Scan using sfd_field_id_idx on section_field_desc sfd_1 (cost=0.28..0.32 rows=1 width=42) (never executed)

  • Index Cond: (field_id = img.field_id)
36. 0.000 0.000 ↓ 0.0 0

Index Scan using u_user_pk on u_user usr_1 (cost=0.29..4.32 rows=1 width=27) (never executed)

  • Index Cond: ((psd_1.finalized_user)::text = (emp_username)::text)
Planning time : 15.173 ms
Execution time : 2,040.441 ms