explain.depesz.com

PostgreSQL's explain analyze made readable

Result: C0XD

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 1,143.378 ↑ 1.0 50 1

Limit (cost=232,754.15..277,875.17 rows=50 width=611) (actual time=1,142.554..1,143.378 rows=50 loops=1)

2. 0.026 1,143.374 ↑ 4.0 50 1

Unique (cost=232,754.15..413,238.24 rows=200 width=611) (actual time=1,142.553..1,143.374 rows=50 loops=1)

3. 0.499 1,143.348 ↑ 2,789.2 50 1

Nested Loop Left Join (cost=232,754.15..412,889.59 rows=139,459 width=611) (actual time=1,142.551..1,143.348 rows=50 loops=1)

4. 0.025 1,142.849 ↑ 2,789.2 50 1

Nested Loop Left Join (cost=232,754.01..355,326.71 rows=139,459 width=491) (actual time=1,142.393..1,142.849 rows=50 loops=1)

5. 0.023 1,142.774 ↑ 2,789.2 50 1

Nested Loop Left Join (cost=232,753.87..333,709.08 rows=139,459 width=413) (actual time=1,142.389..1,142.774 rows=50 loops=1)

6. 0.020 1,142.751 ↑ 2,789.2 50 1

Nested Loop Left Join (cost=232,753.72..310,659.95 rows=139,459 width=295) (actual time=1,142.386..1,142.751 rows=50 loops=1)

7. 0.030 1,142.681 ↑ 2,789.2 50 1

Merge Left Join (cost=232,753.57..287,646.70 rows=139,459 width=173) (actual time=1,142.379..1,142.681 rows=50 loops=1)

  • Merge Cond: ("*SELECT* 1".codigo = cr_fat.contasareceber_codigo)
8. 0.057 1,142.491 ↑ 2,789.2 50 1

Merge Left Join (cost=232,753.15..238,945.25 rows=139,459 width=161) (actual time=1,142.365..1,142.491 rows=50 loops=1)

  • Merge Cond: ("*SELECT* 1".codigo = cr_sit.contasareceber_codigo)
9. 50.566 955.039 ↑ 2,789.2 50 1

Sort (cost=129,159.60..129,508.25 rows=139,459 width=157) (actual time=955.029..955.039 rows=50 loops=1)

  • Sort Key: "*SELECT* 1".codigo
  • Sort Method: external merge Disk: 16264kB
10. 22.653 904.473 ↑ 1.2 117,970 1

Hash Left Join (cost=64,656.78..106,277.69 rows=139,459 width=157) (actual time=463.543..904.473 rows=117,970 loops=1)

  • Hash Cond: ("*SELECT* 1".vendedores_codigo = vend.codigo)
11. 5.923 881.777 ↑ 1.2 117,970 1

Append (cost=64,653.91..105,900.98 rows=139,459 width=148) (actual time=463.478..881.777 rows=117,970 loops=1)

12. 13.246 875.328 ↑ 1.2 117,956 1

Subquery Scan on *SELECT* 1 (cost=64,653.91..104,733.94 rows=139,022 width=148) (actual time=463.477..875.328 rows=117,956 loops=1)

13. 262.790 862.082 ↑ 1.2 117,956 1

Hash Join (cost=64,653.91..103,343.72 rows=139,022 width=148) (actual time=463.476..862.082 rows=117,956 loops=1)

  • Hash Cond: (cr.codigo = pvpg_cr.contasareceber_codigo)
14. 135.956 135.956 ↑ 1.0 820,043 1

Seq Scan on contasareceber cr (cost=0.00..16,848.43 rows=820,043 width=49) (actual time=0.040..135.956 rows=820,043 loops=1)

15. 24.824 463.336 ↑ 1.2 117,956 1

Hash (cost=61,558.13..61,558.13 rows=139,022 width=50) (actual time=463.336..463.336 rows=117,956 loops=1)

  • Buckets: 65536 Batches: 4 Memory Usage: 2753kB
16. 141.403 438.512 ↑ 1.2 117,956 1

Hash Join (cost=38,098.92..61,558.13 rows=139,022 width=50) (actual time=248.981..438.512 rows=117,956 loops=1)

  • Hash Cond: (pvpg_cr.prevendas_pagtos_codigo = pvpg.codigo)
17. 48.218 48.218 ↑ 1.0 820,000 1

Seq Scan on prevendas_pagtos_contasareceber pvpg_cr (cost=0.00..11,829.00 rows=820,000 width=8) (actual time=0.005..48.218 rows=820,000 loops=1)

18. 8.576 248.891 ↑ 2.3 37,682 1

Hash (cost=36,266.51..36,266.51 rows=86,033 width=46) (actual time=248.890..248.891 rows=37,682 loops=1)

  • Buckets: 65536 Batches: 2 Memory Usage: 1875kB
19. 81.107 240.315 ↑ 2.3 37,682 1

Hash Join (cost=20,503.66..36,266.51 rows=86,033 width=46) (actual time=116.976..240.315 rows=37,682 loops=1)

  • Hash Cond: (pvpg.codprevenda = pv.codigo)
20. 42.289 42.289 ↑ 1.0 507,455 1

Seq Scan on prevenda_pagto pvpg (cost=0.00..8,313.55 rows=507,455 width=8) (actual time=0.005..42.289 rows=507,455 loops=1)

21. 7.349 116.919 ↑ 2.4 34,092 1

Hash (cost=18,759.91..18,759.91 rows=81,900 width=42) (actual time=116.919..116.919 rows=34,092 loops=1)

  • Buckets: 65536 Batches: 2 Memory Usage: 1682kB
22. 48.996 109.570 ↑ 2.4 34,092 1

Hash Join (cost=1,176.76..18,759.91 rows=81,900 width=42) (actual time=13.329..109.570 rows=34,092 loops=1)

  • Hash Cond: (pv.codcliente = cli.codigo)
23. 47.274 47.274 ↑ 1.0 483,072 1

Seq Scan on prevendas pv (cost=0.00..16,314.72 rows=483,072 width=16) (actual time=0.006..47.274 rows=483,072 loops=1)

24. 0.485 13.300 ↑ 1.1 2,297 1

Hash (cost=1,145.78..1,145.78 rows=2,479 width=30) (actual time=13.300..13.300 rows=2,297 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 175kB
25. 12.815 12.815 ↑ 1.1 2,297 1

Seq Scan on clientes cli (cost=0.00..1,145.78 rows=2,479 width=30) (actual time=0.028..12.815 rows=2,297 loops=1)

  • Filter: ((nome)::text ~~* '%jose%'::text)
  • Rows Removed by Filter: 12325
26. 0.002 0.454 ↓ 1.7 10 1

Subquery Scan on *SELECT* 2 (cost=1.55..379.85 rows=6 width=148) (actual time=0.089..0.454 rows=10 loops=1)

27. 0.004 0.452 ↓ 1.7 10 1

Nested Loop (cost=1.55..379.79 rows=6 width=148) (actual time=0.088..0.452 rows=10 loops=1)

28. 0.004 0.398 ↓ 1.7 10 1

Nested Loop (cost=1.13..329.13 rows=6 width=50) (actual time=0.066..0.398 rows=10 loops=1)

29. 0.061 0.289 ↑ 1.0 35 1

Nested Loop (cost=0.84..317.95 rows=35 width=24) (actual time=0.055..0.289 rows=35 loops=1)

30. 0.008 0.123 ↑ 1.0 35 1

Nested Loop (cost=0.42..296.75 rows=35 width=12) (actual time=0.036..0.123 rows=35 loops=1)

31. 0.010 0.010 ↑ 1.0 35 1

Seq Scan on saidasnf_pagtos_contasareceber snfpg_cr (cost=0.00..1.35 rows=35 width=8) (actual time=0.008..0.010 rows=35 loops=1)

32. 0.105 0.105 ↑ 1.0 1 35

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

  • Index Cond: (codigo = snfpg_cr.saidasnf_pagtos_codigo)
33. 0.105 0.105 ↑ 1.0 1 35

Index Scan using saidasnf_codigo_index on saidasnf snf (cost=0.42..0.61 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=35)

  • Index Cond: (codigo = snfpg.codsaidasnf)
34. 0.105 0.105 ↓ 0.0 0 35

Index Scan using unq_clientes on clientes cli_1 (cost=0.29..0.32 rows=1 width=30) (actual time=0.003..0.003 rows=0 loops=35)

  • Index Cond: (codigo = snf.codcliente)
  • Filter: ((nome)::text ~~* '%jose%'::text)
  • Rows Removed by Filter: 1
35. 0.050 0.050 ↑ 1.0 1 10

Index Scan using contasareceber_pkey1 on contasareceber cr_1 (cost=0.42..8.44 rows=1 width=49) (actual time=0.005..0.005 rows=1 loops=10)

  • Index Cond: (codigo = snfpg_cr.contasareceber_codigo)
36. 0.001 0.072 ↑ 107.8 4 1

Subquery Scan on *SELECT* 3 (cost=0.86..89.90 rows=431 width=148) (actual time=0.062..0.072 rows=4 loops=1)

37. 0.003 0.071 ↑ 107.8 4 1

Nested Loop Left Join (cost=0.86..85.59 rows=431 width=148) (actual time=0.061..0.071 rows=4 loops=1)

38. 0.003 0.064 ↓ 2.0 4 1

Nested Loop Left Join (cost=0.71..78.24 rows=2 width=91) (actual time=0.057..0.064 rows=4 loops=1)

  • Join Filter: (cav.contasareceber_avulsas_codigo = crav.codigo)
  • Rows Removed by Join Filter: 14
39. 0.003 0.057 ↓ 2.0 2 1

Nested Loop Left Join (cost=0.71..77.04 rows=1 width=87) (actual time=0.053..0.057 rows=2 loops=1)

  • Join Filter: (cat.contasareceber_avulsas_codigo = crav.codigo)
  • Rows Removed by Join Filter: 1
40. 0.001 0.052 ↑ 1.0 1 1

Nested Loop (cost=0.71..75.97 rows=1 width=83) (actual time=0.049..0.052 rows=1 loops=1)

41. 0.000 0.048 ↑ 1.0 1 1

Nested Loop (cost=0.29..67.53 rows=1 width=38) (actual time=0.044..0.048 rows=1 loops=1)

42. 0.016 0.016 ↑ 1.0 8 1

Seq Scan on contasareceber_avulsas crav (cost=0.00..1.08 rows=8 width=12) (actual time=0.016..0.016 rows=8 loops=1)

43. 0.032 0.032 ↓ 0.0 0 8

Index Scan using unq_clientes on clientes cli_2 (cost=0.29..8.30 rows=1 width=30) (actual time=0.004..0.004 rows=0 loops=8)

  • Index Cond: (codigo = crav.clientes_codigo)
  • Filter: ((nome)::text ~~* '%jose%'::text)
  • Rows Removed by Filter: 1
44. 0.003 0.003 ↑ 1.0 1 1

Index Scan using contasareceber_pkey1 on contasareceber cr_2 (cost=0.42..8.44 rows=1 width=49) (actual time=0.003..0.003 rows=1 loops=1)

  • Index Cond: (codigo = crav.contasareceber_codigo)
45. 0.002 0.002 ↑ 1.0 3 1

Seq Scan on contasareceber_avulsas_tecnicos cat (cost=0.00..1.03 rows=3 width=8) (actual time=0.002..0.002 rows=3 loops=1)

46. 0.004 0.004 ↑ 1.0 9 2

Seq Scan on contasareceber_avulsas_vendedores cav (cost=0.00..1.09 rows=9 width=8) (actual time=0.001..0.002 rows=9 loops=2)

47. 0.004 0.004 ↓ 0.0 0 4

Index Scan using contasareceber_avulsas_contas_contasareceber_avulsas_codigo_key on contasareceber_avulsas_contasareceber_avulsas_lotes crav_lot (cost=0.15..3.67 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=4)

  • Index Cond: (crav.codigo = contasareceber_avulsas_codigo)
48. 0.005 0.043 ↑ 1.0 39 1

Hash (cost=2.39..2.39 rows=39 width=13) (actual time=0.043..0.043 rows=39 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
49. 0.038 0.038 ↑ 1.0 39 1

Seq Scan on vendedores vend (cost=0.00..2.39 rows=39 width=13) (actual time=0.007..0.038 rows=39 loops=1)

50. 141.473 187.395 ↑ 3,388.6 242 1

Sort (cost=103,593.55..105,643.66 rows=820,043 width=8) (actual time=187.330..187.395 rows=242 loops=1)

  • Sort Key: cr_sit.contasareceber_codigo
  • Sort Method: external merge Disk: 14536kB
51. 45.922 45.922 ↑ 1.0 820,043 1

Seq Scan on contasareceber_situacao cr_sit (cost=0.00..11,829.43 rows=820,043 width=8) (actual time=0.006..45.922 rows=820,043 loops=1)

52. 0.160 0.160 ↑ 3,388.5 242 1

Index Scan using contasareceber_faturamentos_pkey on contasareceber_faturamentos cr_fat (cost=0.42..44,908.20 rows=820,006 width=12) (actual time=0.012..0.160 rows=242 loops=1)

53. 0.050 0.050 ↑ 1.0 1 50

Index Scan using situacoescontas_pkey on situacoescontas sc (cost=0.15..0.17 rows=1 width=126) (actual time=0.001..0.001 rows=1 loops=50)

  • Index Cond: (cr_sit.situacoesconta_codigo = codigo)
54. 0.000 0.000 ↓ 0.0 0 50

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=50)

  • Index Cond: (codigo = "*SELECT* 1".gruposcontas_codigo)
55. 0.050 0.050 ↑ 1.0 1 50

Index Scan using tipodocumento_pkey on tipodocumento t (cost=0.14..0.16 rows=1 width=82) (actual time=0.001..0.001 rows=1 loops=50)

  • Index Cond: (codigo = "*SELECT* 1".tipodocumento_codigo)
56. 0.000 0.000 ↓ 0.0 0 50

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

  • Index Cond: (codigo = "*SELECT* 1".tecnicos_codigo)
Planning time : 7.173 ms
Execution time : 1,147.947 ms