explain.depesz.com

PostgreSQL's explain analyze made readable

Result: X6r0

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 4,375.275 ↑ 1.0 50 1

Limit (cost=22.88..32,182.38 rows=50 width=582) (actual time=4,368.697..4,375.275 rows=50 loops=1)

2. 0.042 4,375.269 ↑ 82.0 50 1

Unique (cost=22.88..2,637,101.32 rows=4,100 width=582) (actual time=4,368.697..4,375.269 rows=50 loops=1)

3. 0.872 4,375.227 ↑ 82.0 50 1

Nested Loop Left Join (cost=22.88..2,637,091.07 rows=4,100 width=582) (actual time=4,368.695..4,375.227 rows=50 loops=1)

4. 0.038 4,374.155 ↑ 82.0 50 1

Nested Loop Left Join (cost=22.46..2,633,957.14 rows=4,100 width=557) (actual time=4,368.391..4,374.155 rows=50 loops=1)

5. 0.056 4,374.117 ↑ 82.0 50 1

Nested Loop Left Join (cost=22.32..2,633,050.37 rows=4,100 width=439) (actual time=4,368.388..4,374.117 rows=50 loops=1)

  • Join Filter: (v.codigo = COALESCE(pv.codvendedor, snf.codvendedor, cav.vendedores_codigo))
  • Rows Removed by Join Filter: 450
6. 0.046 4,374.011 ↑ 82.0 50 1

Nested Loop Left Join (cost=22.32..2,630,660.49 rows=4,100 width=430) (actual time=4,368.363..4,374.011 rows=50 loops=1)

7. 0.034 4,373.965 ↑ 82.0 50 1

Nested Loop Left Join (cost=22.17..2,629,498.02 rows=4,100 width=426) (actual time=4,368.357..4,373.965 rows=50 loops=1)

8. 103.238 4,373.631 ↑ 82.0 50 1

Nested Loop Left Join (cost=21.88..2,619,896.99 rows=4,100 width=400) (actual time=4,368.324..4,373.631 rows=50 loops=1)

  • Filter: (COALESCE(pv.codvendedor, snf.codvendedor, cav.vendedores_codigo) = 1)
  • Rows Removed by Filter: 274970
9. 161.345 4,270.393 ↑ 3.0 275,020 1

Nested Loop Left Join (cost=21.73..2,379,201.99 rows=820,003 width=396) (actual time=0.150..4,270.393 rows=275,020 loops=1)

10. 87.782 4,109.048 ↑ 3.0 275,020 1

Nested Loop Left Join (cost=21.31..1,882,600.87 rows=820,003 width=388) (actual time=0.149..4,109.048 rows=275,020 loops=1)

11. 85.293 3,471.226 ↑ 3.0 275,020 1

Nested Loop Left Join (cost=20.89..1,438,993.63 rows=820,003 width=380) (actual time=0.146..3,471.226 rows=275,020 loops=1)

12. 160.071 3,110.913 ↑ 3.0 275,020 1

Nested Loop Left Join (cost=20.75..1,312,467.41 rows=820,003 width=302) (actual time=0.142..3,110.913 rows=275,020 loops=1)

13. 133.828 2,950.842 ↑ 3.0 275,020 1

Nested Loop Left Join (cost=20.60..1,177,122.89 rows=820,003 width=184) (actual time=0.140..2,950.842 rows=275,020 loops=1)

14. 135.470 2,541.994 ↑ 3.0 275,020 1

Merge Left Join (cost=20.45..1,041,807.64 rows=820,003 width=63) (actual time=0.136..2,541.994 rows=275,020 loops=1)

  • Merge Cond: (cr.codigo = cr_sit.contasareceber_codigo)
15. 82.896 2,224.500 ↑ 3.0 275,020 1

Merge Left Join (cost=14.72..990,881.97 rows=820,003 width=59) (actual time=0.128..2,224.500 rows=275,020 loops=1)

  • Merge Cond: (cr.codigo = crav.contasareceber_codigo)
16. 126.602 2,141.591 ↑ 3.0 275,020 1

Nested Loop Left Join (cost=14.57..988,727.71 rows=820,003 width=51) (actual time=0.114..2,141.591 rows=275,020 loops=1)

17. 92.040 1,464.949 ↑ 3.0 275,020 1

Nested Loop Left Join (cost=14.15..545,120.47 rows=820,003 width=47) (actual time=0.108..1,464.949 rows=275,020 loops=1)

18. 109.135 822.869 ↑ 3.0 275,020 1

Merge Join (cost=13.72..165,787.10 rows=820,003 width=47) (actual time=0.101..822.869 rows=275,020 loops=1)

  • Merge Cond: (cr.codigo = cr_fat.contasareceber_codigo)
19. 135.672 496.478 ↑ 3.0 275,020 1

Merge Left Join (cost=6.90..106,520.33 rows=820,038 width=47) (actual time=0.090..496.478 rows=275,020 loops=1)

  • Merge Cond: (cr.codigo = pvpg_cr.contasareceber_codigo)
20. 86.801 173.184 ↑ 3.0 275,020 1

Merge Left Join (cost=1.43..55,661.18 rows=820,038 width=43) (actual time=0.081..173.184 rows=275,020 loops=1)

  • Merge Cond: (cr.codigo = snfpg_cr.contasareceber_codigo)
21. 86.312 86.312 ↑ 3.0 275,020 1

Index Scan using contasareceber_pkey1 on contasareceber cr (cost=0.42..42,216.05 rows=820,038 width=35) (actual time=0.006..86.312 rows=275,020 loops=1)

22. 0.003 0.071 ↑ 2,260.0 1 1

Materialize (cost=1.00..11,366.78 rows=2,260 width=12) (actual time=0.071..0.071 rows=1 loops=1)

23. 0.001 0.068 ↑ 2,260.0 1 1

Nested Loop Left Join (cost=1.00..11,361.13 rows=2,260 width=12) (actual time=0.068..0.068 rows=1 loops=1)

24. 0.002 0.038 ↑ 2,260.0 1 1

Nested Loop Left Join (cost=0.58..9,992.46 rows=2,260 width=8) (actual time=0.038..0.038 rows=1 loops=1)

25. 0.004 0.004 ↑ 2,260.0 1 1

Index Only Scan using saidasnf_pagtos_contasarecebe_contasareceber_codigo_saidasn_key on saidasnf_pagtos_contasareceber snfpg_cr (cost=0.15..82.06 rows=2,260 width=8) (actual time=0.004..0.004 rows=1 loops=1)

  • Heap Fetches: 1
26. 0.032 0.032 ↑ 1.0 1 1

Index Scan using saidasnf_pagto_pkey on saidasnf_pagto snfpg (cost=0.42..4.39 rows=1 width=8) (actual time=0.032..0.032 rows=1 loops=1)

  • Index Cond: (snfpg_cr.saidasnf_pagtos_codigo = codigo)
27. 0.029 0.029 ↑ 1.0 1 1

Index Scan using saidasnf_codigo_index on saidasnf snf_1 (cost=0.42..0.61 rows=1 width=8) (actual time=0.029..0.029 rows=1 loops=1)

  • Index Cond: (snfpg.codsaidasnf = codigo)
28. 187.622 187.622 ↑ 3.0 275,020 1

Index Only Scan using prevendas_pagtos_contasareceb_contasareceber_codigo_prevend_key on prevendas_pagtos_contasareceber pvpg_cr (cost=0.42..38,560.08 rows=819,997 width=8) (actual time=0.008..187.622 rows=275,020 loops=1)

  • Heap Fetches: 275020
29. 217.256 217.256 ↑ 3.0 275,020 1

Index Only Scan using contasareceber_faturamentos_pkey on contasareceber_faturamentos cr_fat (cost=0.42..46,970.48 rows=820,003 width=4) (actual time=0.010..217.256 rows=275,020 loops=1)

  • Index Cond: (contasareceber_codigo IS NOT NULL)
  • Heap Fetches: 275020
30. 550.040 550.040 ↑ 1.0 1 275,020

Index Scan using prevenda_pagto_pkey on prevenda_pagto pvpg (cost=0.42..0.46 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=275,020)

  • Index Cond: (pvpg_cr.prevendas_pagtos_codigo = codigo)
31. 550.040 550.040 ↑ 1.0 1 275,020

Index Scan using prevendas_codigo_index on prevendas pv_1 (cost=0.42..0.54 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=275,020)

  • Index Cond: (pvpg.codprevenda = codigo)
32. 0.013 0.013 ↑ 2,040.0 1 1

Index Scan using contasareceber_avulsas_contasareceber_codigo_key on contasareceber_avulsas crav (cost=0.15..78.75 rows=2,040 width=12) (actual time=0.013..0.013 rows=1 loops=1)

33. 182.024 182.024 ↑ 3.0 275,020 1

Index Scan using contasareceber_situacao_pkey on contasareceber_situacao cr_sit (cost=0.42..38,625.54 rows=820,038 width=8) (actual time=0.007..182.024 rows=275,020 loops=1)

34. 275.020 275.020 ↑ 1.0 1 275,020

Index Scan using situacoescontas_pkey on situacoescontas sc (cost=0.15..0.17 rows=1 width=125) (actual time=0.001..0.001 rows=1 loops=275,020)

  • Index Cond: (cr_sit.situacoesconta_codigo = codigo)
35. 0.000 0.000 ↓ 0.0 0 275,020

Index Scan using gruposcontas_pkey on gruposcontas grct (cost=0.15..0.17 rows=1 width=122) (actual time=0.000..0.000 rows=0 loops=275,020)

  • Index Cond: (codigo = cr.gruposcontas_codigo)
36. 275.020 275.020 ↑ 1.0 1 275,020

Index Scan using tipodocumento_pkey on tipodocumento t_1 (cost=0.14..0.16 rows=1 width=82) (actual time=0.001..0.001 rows=1 loops=275,020)

  • Index Cond: (codigo = cr.tipodocumento_codigo)
37. 550.040 550.040 ↑ 1.0 1 275,020

Index Scan using prevendas_codigo_index on prevendas pv (cost=0.42..0.54 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=275,020)

  • Index Cond: (codigo = pvpg.codprevenda)
38. 0.000 0.000 ↓ 0.0 0 275,020

Index Scan using saidasnf_codigo_index on saidasnf snf (cost=0.42..0.61 rows=1 width=12) (actual time=0.000..0.000 rows=0 loops=275,020)

  • Index Cond: (codigo = snfpg.codsaidasnf)
39. 0.000 0.000 ↓ 0.0 0 275,020

Index Only Scan using contasareceber_avulsas_vended_contasareceber_avulsas_codigo_key on contasareceber_avulsas_vendedores cav (cost=0.15..0.24 rows=4 width=8) (actual time=0.000..0.000 rows=0 loops=275,020)

  • Index Cond: (contasareceber_avulsas_codigo = crav.codigo)
  • Heap Fetches: 0
40. 0.300 0.300 ↑ 1.0 1 50

Index Scan using unq_clientes on clientes cli (cost=0.29..2.34 rows=1 width=30) (actual time=0.006..0.006 rows=1 loops=50)

  • Index Cond: (codigo = CASE WHEN (crav.clientes_codigo IS NOT NULL) THEN crav.clientes_codigo WHEN (pv_1.codcliente IS NOT NULL) THEN pv_1.codcliente WHEN (snf_1.codcliente IS NOT NULL) THEN snf_1.codcliente ELSE NULL::integer END)
41. 0.000 0.000 ↓ 0.0 0 50

Index Only Scan using contasareceber_avulsas_tecnic_contasareceber_avulsas_codigo_key on contasareceber_avulsas_tecnicos cat (cost=0.15..0.24 rows=4 width=8) (actual time=0.000..0.000 rows=0 loops=50)

  • Index Cond: (contasareceber_avulsas_codigo = crav.codigo)
  • Heap Fetches: 0
42. 0.032 0.050 ↑ 3.9 10 50

Materialize (cost=0.00..2.58 rows=39 width=13) (actual time=0.001..0.001 rows=10 loops=50)

43. 0.018 0.018 ↑ 3.9 10 1

Seq Scan on vendedores v (cost=0.00..2.39 rows=39 width=13) (actual time=0.017..0.018 rows=10 loops=1)

44. 0.000 0.000 ↓ 0.0 0 50

Index Scan using tecnicos_pkey on tecnicos t (cost=0.14..0.22 rows=1 width=122) (actual time=0.000..0.000 rows=0 loops=50)

  • Index Cond: (codigo = COALESCE(pv.codtecnico, snf.codtecnico, cat.tecnicos_codigo))
45. 0.200 0.200 ↑ 1.0 1 50

Index Scan using contasareceber_pagtos_contasareceber_faturamentos_cr_codigo_idx on contasareceber_pagtos crpg (cost=0.42..0.50 rows=1 width=12) (actual time=0.003..0.004 rows=1 loops=50)

  • Index Cond: (contasareceber_faturamentos_cr_codigo = cr.codigo)
Planning time : 17.633 ms
Execution time : 4,375.521 ms