explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gUGR : Insurance Invoice Summary Report

Settings
# exclusive inclusive rows x rows loops node
1. 2.737 2,861.343 ↓ 1,772.5 3,545 1

Unique (cost=712,360.60..712,360.71 rows=2 width=393) (actual time=2,858.374..2,861.343 rows=3,545 loops=1)

2. 50.031 2,858.606 ↓ 1,778.5 3,557 1

Sort (cost=712,360.60..712,360.61 rows=2 width=393) (actual time=2,858.372..2,858.606 rows=3,557 loops=1)

  • Sort Key: ep.exme_paciente_id, cp.documentno, ext.extensionno, cp.ad_org_id, cb.c_bpartner_id, cp.exme_ctapac_id, ext.exme_ctapacext_id, cpd.datedelivered, (COALESCE(cb.name, ''::character varying)), ep.nombre_pac, ((SubPlan 1)), (to_char(cp.dateor (...)
  • Sort Method: quicksort Memory: 3,069kB
3. 0.000 2,808.575 ↓ 1,778.5 3,557 1

Gather (cost=1,002.70..712,360.59 rows=2 width=393) (actual time=384.654..2,808.575 rows=3,557 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 1.663 468.330 ↓ 1,186.0 1,186 3 / 3

Nested Loop Left Join (cost=2.70..709,484.52 rows=1 width=301) (actual time=362.720..468.330 rows=1,186 loops=3)

5. 1.436 460.739 ↓ 1,186.0 1,186 3 / 3

Nested Loop Left Join (cost=2.41..709,481.29 rows=1 width=270) (actual time=362.682..460.739 rows=1,186 loops=3)

  • Join Filter: (pa.ad_org_id = cp.ad_org_id)
  • Rows Removed by Join Filter: 1,186
6. 2.247 452.189 ↓ 1,186.0 1,186 3 / 3

Nested Loop (cost=1.99..709,480.82 rows=1 width=259) (actual time=362.638..452.189 rows=1,186 loops=3)

7. 1.041 444.014 ↓ 1,186.0 1,186 3 / 3

Nested Loop Left Join (cost=1.56..709,473.17 rows=1 width=213) (actual time=362.606..444.014 rows=1,186 loops=3)

8. 1.915 438.230 ↓ 1,186.0 1,186 3 / 3

Nested Loop Left Join (cost=1.28..709,472.87 rows=1 width=204) (actual time=362.578..438.230 rows=1,186 loops=3)

9. 1.974 429.201 ↓ 1,186.0 1,186 3 / 3

Nested Loop (cost=0.86..709,472.39 rows=1 width=171) (actual time=362.538..429.201 rows=1,186 loops=3)

10. 0.800 417.742 ↓ 2.9 1,186 3 / 3

Nested Loop (cost=0.44..709,158.38 rows=416 width=108) (actual time=362.481..417.742 rows=1,186 loops=3)

11. 380.310 380.310 ↑ 1.3 643 3 / 3

Parallel Seq Scan on exme_ctapacext ext (cost=0.00..80,841.76 rows=814 width=16) (actual time=129.175..380.310 rows=643 loops=3)

  • Filter: (c_bpartner_id = '10017972'::numeric)
  • Rows Removed by Filter: 591,426
12. 36.632 36.632 ↑ 6.0 2 1,928 / 3

Index Scan using exme_ctapacdet_uk1 on exme_ctapacdet cpd (cost=0.44..771.77 rows=12 width=98) (actual time=0.043..0.057 rows=2 loops=1,928)

  • Index Cond: (exme_ctapacext_id = ext.exme_ctapacext_id)
  • Filter: ((datedelivered >= to_date('01/07/2019'::text, 'dd/MM/yyyy'::text)) AND (datedelivered <= to_date('30/09/2019'::text, 'dd/MM/yyyy'::text)))
  • Rows Removed by Filter: 10
13. 9.485 9.485 ↑ 1.0 1 3,557 / 3

Index Scan using exme_ctapac_pkey on exme_ctapac cp (cost=0.42..0.75 rows=1 width=69) (actual time=0.008..0.008 rows=1 loops=3,557)

  • Index Cond: (exme_ctapac_id = cpd.exme_ctapac_id)
  • Filter: ((ad_org_id = ANY ('{0,10004062}'::numeric[])) AND (ad_client_id = '10001087'::numeric))
14. 7.114 7.114 ↑ 1.0 1 3,557 / 3

Index Scan using m_product_pkey on m_product mp (cost=0.42..0.48 rows=1 width=45) (actual time=0.006..0.006 rows=1 loops=3,557)

  • Index Cond: (m_product_id = cpd.m_product_id)
15. 4.743 4.743 ↑ 1.0 1 3,557 / 3

Index Scan using m_product_category_pkey on m_product_category pcat (cost=0.28..0.30 rows=1 width=23) (actual time=0.004..0.004 rows=1 loops=3,557)

  • Index Cond: (m_product_category_id = mp.m_product_category_id)
16. 5.928 5.928 ↑ 1.0 1 3,557 / 3

Index Scan using exme_paciente_pkey on exme_paciente ep (cost=0.42..7.65 rows=1 width=52) (actual time=0.005..0.005 rows=1 loops=3,557)

  • Index Cond: (exme_paciente_id = cp.exme_paciente_id)
17. 7.114 7.114 ↑ 1.0 1 3,557 / 3

Index Scan using exme_pacienteaseg_exme_paciente_id on exme_pacienteaseg pa (cost=0.42..0.46 rows=1 width=20) (actual time=0.005..0.006 rows=1 loops=3,557)

  • Index Cond: (exme_paciente_id = ep.exme_paciente_id)
  • Filter: ((priority = '1'::numeric) AND (isactive = 'Y'::bpchar))
18. 5.928 5.928 ↑ 1.0 1 3,557 / 3

Index Scan using c_bpartner_pkey on c_bpartner cb (cost=0.29..3.22 rows=1 width=38) (actual time=0.005..0.005 rows=1 loops=3,557)

  • Index Cond: ((c_bpartner_id = ext.c_bpartner_id) AND (c_bpartner_id = '10017972'::numeric))
19.          

SubPlan (for Gather)

20. 7.114 369.928 ↑ 3.0 1 3,557

Unique (cost=46.33..46.34 rows=3 width=170) (actual time=0.102..0.104 rows=1 loops=3,557)

21. 21.342 362.814 ↓ 2.7 8 3,557

Sort (cost=46.33..46.34 rows=3 width=170) (actual time=0.101..0.102 rows=8 loops=3,557)

  • Sort Key: (array_to_string(array_agg(COALESCE((((d.value)::text || '-'::text) || (d.name)::text), (cp.diagnostico_ingreso)::text, ''::text)) OVER (?), '. '::text))
  • Sort Method: quicksort Memory: 26kB
22. 167.179 341.472 ↓ 2.7 8 3,557

WindowAgg (cost=1.13..46.30 rows=3 width=170) (actual time=0.065..0.096 rows=8 loops=3,557)

23. 15.791 174.293 ↓ 2.7 8 3,557

Nested Loop Left Join (cost=1.13..46.24 rows=3 width=201) (actual time=0.016..0.049 rows=8 loops=3,557)

24. 24.899 74.697 ↓ 2.7 8 3,557

Nested Loop Left Join (cost=0.85..21.33 rows=3 width=6) (actual time=0.012..0.021 rows=8 loops=3,557)

  • Join Filter: (apd.exme_ctapac_id = cp2.exme_ctapac_id)
25. 17.785 17.785 ↑ 1.0 1 3,557

Index Only Scan using exme_ctapac_pkey on exme_ctapac cp2 (cost=0.42..8.44 rows=1 width=6) (actual time=0.005..0.005 rows=1 loops=3,557)

  • Index Cond: (exme_ctapac_id = cp.exme_ctapac_id)
  • Heap Fetches: 0
26. 32.013 32.013 ↓ 2.7 8 3,557

Index Scan using actpacientediag_ctapac on exme_actpacientediag apd (cost=0.42..12.85 rows=3 width=12) (actual time=0.005..0.009 rows=8 loops=3,557)

  • Index Cond: (exme_ctapac_id = cp.exme_ctapac_id)
27. 83.805 83.805 ↑ 1.0 1 27,935

Index Scan using exme_diagnostico_pkey on exme_diagnostico d (cost=0.29..8.30 rows=1 width=69) (actual time=0.003..0.003 rows=1 loops=27,935)

  • Index Cond: (apd.exme_diagnostico_id = exme_diagnostico_id)
28. 373.485 2,027.490 ↑ 1.0 1 3,557

Aggregate (cost=891.57..891.58 rows=1 width=32) (actual time=0.570..0.570 rows=1 loops=3,557)

29. 1,654.005 1,654.005 ↓ 1.9 370 3,557

Index Scan using exmectapacdet_cta_ext_active_idx on exme_ctapacdet cpd_1 (cost=0.56..890.59 rows=197 width=12) (actual time=0.025..0.465 rows=370 loops=3,557)

  • Index Cond: ((exme_ctapac_id = cp.exme_ctapac_id) AND (isactive = 'Y'::bpchar) AND (sedevolvio = 'N'::bpchar))
  • Filter: (tipolinea = ANY ('{CG,PB}'::bpchar[]))
  • Rows Removed by Filter: 0
Planning time : 10.283 ms
Execution time : 2,862.288 ms