explain.depesz.com

PostgreSQL's explain analyze made readable

Result: igGh

Settings
# exclusive inclusive rows x rows loops node
1. 305.527 3,719.261 ↓ 1.6 172,570 1

Sort (cost=2,331,359.42..2,331,624.50 rows=106,034 width=1,057) (actual time=3,701.698..3,719.261 rows=172,570 loops=1)

  • Sort Key: ((SubPlan 3))
  • Sort Method: quicksort Memory: 82121kB
2. 551.338 3,413.734 ↓ 1.6 172,570 1

Subquery Scan on cob_rv_ocorrencia (cost=30,695.37..2,293,638.52 rows=106,034 width=1,057) (actual time=182.918..3,413.734 rows=172,570 loops=1)

3. 0.000 273.846 ↓ 1.6 172,570 1

Gather Merge (cost=30,695.37..43,066.87 rows=106,034 width=741) (actual time=182.855..273.846 rows=172,570 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 97.326 558.456 ↓ 1.1 57,523 3

Sort (cost=29,695.35..29,827.89 rows=53,017 width=741) (actual time=179.377..186.152 rows=57,523 loops=3)

  • Sort Key: hc.datestart DESC
  • Sort Method: quicksort Memory: 22889kB
5. 28.641 461.130 ↓ 1.1 57,523 3

Hash Left Join (cost=12,553.41..25,535.06 rows=53,017 width=741) (actual time=55.173..153.710 rows=57,523 loops=3)

  • Hash Cond: (hc.cob_tiporesultadovisita_id = trv.cob_tiporesultadovisita_id)
6. 31.551 432.480 ↓ 1.1 57,523 3

Hash Left Join (cost=12,539.81..25,382.29 rows=53,017 width=301) (actual time=55.163..144.160 rows=57,523 loops=3)

  • Hash Cond: (c.cob_segmentocontrato_id = sc.cob_segmentocontrato_id)
7. 51.129 400.848 ↓ 1.1 57,523 3

Hash Left Join (cost=12,538.29..25,233.44 rows=53,017 width=282) (actual time=55.124..133.616 rows=57,523 loops=3)

  • Hash Cond: (hc.ad_user_id = u.ad_user_id)
8. 55.575 257.499 ↓ 1.1 57,523 3

Hash Left Join (cost=5,519.66..18,075.64 rows=53,017 width=213) (actual time=24.161..85.833 rows=57,523 loops=3)

  • Hash Cond: (c.cob_pndevedor_id = bp.c_bpartner_id)
9. 52.857 154.872 ↓ 1.1 57,523 3

Hash Left Join (cost=2,472.51..14,889.29 rows=53,017 width=183) (actual time=8.412..51.624 rows=57,523 loops=3)

  • Hash Cond: (hc.cob_cobranca_id = c.cob_cobranca_id)
10. 77.076 77.076 ↓ 1.1 57,523 3

Parallel Seq Scan on cob_historicocontato hc (cost=0.00..12,277.59 rows=53,017 width=166) (actual time=0.011..25.692 rows=57,523 loops=3)

  • Filter: ((ad_client_id = ANY ('{0,1000000}'::numeric[])) AND (isactive = 'Y'::bpchar) AND (ad_org_id = ANY ('{0,5000004,5000003}'::numeric[])))
  • Rows Removed by Filter: 80
11. 8.295 24.939 ↓ 1.0 20,424 3

Hash (cost=2,217.78..2,217.78 rows=20,378 width=24) (actual time=8.313..8.313 rows=20,424 loops=3)

  • Buckets: 32768 Batches: 1 Memory Usage: 1304kB
12. 16.644 16.644 ↓ 1.0 20,424 3

Seq Scan on cob_cobranca c (cost=0.00..2,217.78 rows=20,378 width=24) (actual time=0.012..5.548 rows=20,424 loops=3)

13. 11.688 47.052 ↓ 1.0 24,547 3

Hash (cost=2,740.40..2,740.40 rows=24,540 width=36) (actual time=15.684..15.684 rows=24,547 loops=3)

  • Buckets: 32768 Batches: 1 Memory Usage: 1920kB
14. 35.364 35.364 ↓ 1.0 24,547 3

Seq Scan on c_bpartner bp (cost=0.00..2,740.40 rows=24,540 width=36) (actual time=0.013..11.788 rows=24,547 loops=3)

15. 45.798 92.220 ↓ 1.1 77,882 3

Hash (cost=6,137.17..6,137.17 rows=70,517 width=82) (actual time=30.740..30.740 rows=77,882 loops=3)

  • Buckets: 131072 Batches: 1 Memory Usage: 7325kB
16. 46.422 46.422 ↓ 1.1 77,882 3

Seq Scan on ad_user u (cost=0.00..6,137.17 rows=70,517 width=82) (actual time=0.011..15.474 rows=77,882 loops=3)

17. 0.027 0.081 ↓ 1.5 34 3

Hash (cost=1.23..1.23 rows=23 width=24) (actual time=0.027..0.027 rows=34 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
18. 0.054 0.054 ↓ 1.5 34 3

Seq Scan on cob_segmentocontrato sc (cost=0.00..1.23 rows=23 width=24) (actual time=0.015..0.018 rows=34 loops=3)

19. 0.000 0.009 ↓ 0.0 0 3

Hash (cost=11.60..11.60 rows=160 width=252) (actual time=0.003..0.003 rows=0 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
20. 0.009 0.009 ↓ 0.0 0 3

Seq Scan on cob_tiporesultadovisita trv (cost=0.00..11.60 rows=160 width=252) (actual time=0.003..0.003 rows=0 loops=3)

21.          

SubPlan (forSubquery Scan)

22. 345.140 345.140 ↑ 1.0 1 172,570

Index Scan using cob_cobranca_key on cob_cobranca (cost=0.29..2.51 rows=1 width=32) (actual time=0.001..0.002 rows=1 loops=172,570)

  • Index Cond: (cob_rv_ocorrencia.cob_cobranca_id = cob_cobranca_id)
23. 345.140 345.140 ↓ 0.0 0 172,570

Seq Scan on cob_motivoatraso (cost=0.00..1.24 rows=1 width=32) (actual time=0.002..0.002 rows=0 loops=172,570)

  • Filter: (cob_rv_ocorrencia.cob_motivoatraso_id = cob_motivoatraso_id)
  • Rows Removed by Filter: 19
24. 345.140 345.140 ↑ 1.0 1 172,570

Index Scan using c_bpartner_pkey on c_bpartner (cost=0.29..2.51 rows=1 width=32) (actual time=0.001..0.002 rows=1 loops=172,570)

  • Index Cond: (cob_rv_ocorrencia.c_bpartner_id = c_bpartner_id)
25. 345.140 517.710 ↑ 1.0 1 172,570

Index Scan using cob_historicocontato_key on cob_historicocontato (cost=0.42..5.14 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=172,570)

  • Index Cond: (cob_rv_ocorrencia.cob_historicocontato_id = cob_historicocontato_id)
26.          

SubPlan (forIndex Scan)

27. 172.570 172.570 ↑ 1.0 1 172,570

Index Only Scan using cob_cobranca_key on cob_cobranca cob_cobranca_1 (cost=0.29..2.51 rows=1 width=6) (actual time=0.001..0.001 rows=1 loops=172,570)

  • Index Cond: (cob_cobranca_id = cob_historicocontato.cob_cobranca_id)
  • Heap Fetches: 87597
28. 172.570 172.570 ↑ 1.0 1 172,570

Index Scan using cob_ocorrenciacontato_key on cob_ocorrenciacontato (cost=0.14..2.36 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=172,570)

  • Index Cond: (cob_rv_ocorrencia.cob_ocorrenciacontato_id = cob_ocorrenciacontato_id)
29. 345.140 345.140 ↓ 0.0 0 172,570

Seq Scan on cob_segmentocontrato (cost=0.00..1.29 rows=1 width=32) (actual time=0.001..0.002 rows=0 loops=172,570)

  • Filter: (cob_rv_ocorrencia.cob_segmentocontrato_id = cob_segmentocontrato_id)
  • Rows Removed by Filter: 34
30. 0.000 0.000 ↓ 0.0 0 172,570

Index Scan using cob_tiporesultadovisita_key on cob_tiporesultadovisita (cost=0.14..2.38 rows=1 width=32) (actual time=0.000..0.000 rows=0 loops=172,570)

  • Index Cond: (cob_rv_ocorrencia.cob_tiporesultadovisita_id = cob_tiporesultadovisita_id)
31. 172.570 172.570 ↑ 1.0 1 172,570

Index Scan using c_bpartner_pkey on c_bpartner c_bpartner_1 (cost=0.29..2.51 rows=1 width=24) (actual time=0.001..0.001 rows=1 loops=172,570)

  • Index Cond: (cob_rv_ocorrencia.cob_negociador_id = c_bpartner_id)
32. 345.140 345.140 ↓ 0.0 0 172,570

Seq Scan on cob_segmentocontrato cob_segmentocontrato_1 (cost=0.00..1.29 rows=1 width=32) (actual time=0.001..0.002 rows=0 loops=172,570)

  • Filter: (cob_rv_ocorrencia.cob_segmentocontrato_id = cob_segmentocontrato_id)
  • Rows Removed by Filter: 34
Planning time : 2.223 ms
Execution time : 3,726.804 ms