explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1LGM

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 2,770.390 ↑ 1.0 50 1

Limit (cost=491,322.22..657,607.82 rows=50 width=476) (actual time=2,769.748..2,770.390 rows=50 loops=1)

2. 0.051 2,770.385 ↑ 4.0 50 1

Unique (cost=491,322.22..1,156,464.63 rows=200 width=476) (actual time=2,769.747..2,770.385 rows=50 loops=1)

3. 0.498 2,770.334 ↑ 16,166.7 50 1

Nested Loop Left Join (cost=491,322.22..1,154,443.78 rows=808,337 width=476) (actual time=2,769.745..2,770.334 rows=50 loops=1)

4. 0.037 2,769.786 ↑ 16,166.7 50 1

Nested Loop Left Join (cost=491,322.08..825,095.14 rows=808,337 width=396) (actual time=2,769.566..2,769.786 rows=50 loops=1)

5. 0.019 2,769.749 ↑ 16,166.7 50 1

Nested Loop Left Join (cost=491,321.94..691,707.55 rows=808,337 width=278) (actual time=2,769.563..2,769.749 rows=50 loops=1)

6. 0.033 2,769.680 ↑ 16,166.7 50 1

Merge Left Join (cost=491,321.79..558,317.40 rows=808,337 width=156) (actual time=2,769.555..2,769.680 rows=50 loops=1)

  • Merge Cond: ("*SELECT* 1".codigo = cr_sit.contasareceber_codigo)
7. 0.045 2,769.605 ↑ 16,166.7 50 1

Merge Left Join (cost=491,321.36..507,546.45 rows=808,337 width=152) (actual time=2,769.542..2,769.605 rows=50 loops=1)

  • Merge Cond: ("*SELECT* 1".codigo = cr_fat.contasareceber_codigo)
8. 500.535 2,504.787 ↑ 16,166.7 50 1

Sort (cost=383,338.09..385,358.93 rows=808,337 width=140) (actual time=2,504.775..2,504.787 rows=50 loops=1)

  • Sort Key: "*SELECT* 1".codigo
  • Sort Method: external merge Disk: 100792kB
9. 37.500 2,004.252 ↓ 1.0 815,545 1

Append (cost=77,312.72..187,975.65 rows=808,337 width=140) (actual time=583.703..2,004.252 rows=815,545 loops=1)

10. 88.085 1,953.907 ↓ 1.0 815,512 1

Subquery Scan on *SELECT* 1 (cost=77,312.72..140,094.45 rows=803,905 width=140) (actual time=583.702..1,953.907 rows=815,512 loops=1)

11. 198.808 1,865.822 ↓ 1.0 815,512 1

Hash Join (cost=77,312.72..132,055.40 rows=803,905 width=140) (actual time=583.701..1,865.822 rows=815,512 loops=1)

  • Hash Cond: (pv.codcliente = c.codigo)
12. 455.615 1,651.693 ↑ 1.0 820,000 1

Hash Join (cost=75,987.76..128,577.31 rows=820,000 width=61) (actual time=568.371..1,651.693 rows=820,000 loops=1)

  • Hash Cond: (pvpg_cr.contasareceber_codigo = cr.codigo)
13. 298.557 863.086 ↑ 1.0 820,000 1

Hash Join (cost=40,879.81..75,299.86 rows=820,000 width=16) (actual time=235.351..863.086 rows=820,000 loops=1)

  • Hash Cond: (pvpg.codprevenda = pv.codigo)
14. 278.660 438.159 ↑ 1.0 820,000 1

Hash Join (cost=16,639.69..39,012.21 rows=820,000 width=12) (actual time=108.869..438.159 rows=820,000 loops=1)

  • Hash Cond: (pvpg_cr.prevendas_pagtos_codigo = pvpg.codigo)
15. 50.690 50.690 ↑ 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.018..50.690 rows=820,000 loops=1)

16. 62.057 108.809 ↓ 1.0 507,455 1

Hash (cost=8,313.53..8,313.53 rows=507,453 width=8) (actual time=108.809..108.809 rows=507,455 loops=1)

  • Buckets: 131072 Batches: 8 Memory Usage: 3498kB
17. 46.752 46.752 ↓ 1.0 507,455 1

Seq Scan on prevenda_pagto pvpg (cost=0.00..8,313.53 rows=507,453 width=8) (actual time=0.006..46.752 rows=507,455 loops=1)

18. 59.809 126.370 ↑ 1.0 483,072 1

Hash (cost=16,314.72..16,314.72 rows=483,072 width=8) (actual time=126.370..126.370 rows=483,072 loops=1)

  • Buckets: 131072 Batches: 8 Memory Usage: 3385kB
19. 66.561 66.561 ↑ 1.0 483,072 1

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

20. 188.515 332.992 ↑ 1.0 820,042 1

Hash (cost=16,848.42..16,848.42 rows=820,042 width=49) (actual time=332.992..332.992 rows=820,042 loops=1)

  • Buckets: 65536 Batches: 32 Memory Usage: 2765kB
21. 144.477 144.477 ↑ 1.0 820,042 1

Seq Scan on contasareceber cr (cost=0.00..16,848.42 rows=820,042 width=49) (actual time=0.025..144.477 rows=820,042 loops=1)

22. 2.559 15.321 ↓ 1.0 14,493 1

Hash (cost=1,145.78..1,145.78 rows=14,335 width=30) (actual time=15.321..15.321 rows=14,493 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 1029kB
23. 12.762 12.762 ↓ 1.0 14,493 1

Seq Scan on clientes c (cost=0.00..1,145.78 rows=14,335 width=30) (actual time=0.008..12.762 rows=14,493 loops=1)

  • Filter: ((nome)::text ~~* '%a%'::text)
  • Rows Removed by Filter: 129
24. 0.017 0.390 ↑ 85.2 26 1

Subquery Scan on *SELECT* 2 (cost=1.55..27,889.84 rows=2,216 width=140) (actual time=0.093..0.390 rows=26 loops=1)

25. 0.008 0.373 ↑ 85.2 26 1

Nested Loop (cost=1.55..27,867.68 rows=2,216 width=140) (actual time=0.079..0.373 rows=26 loops=1)

26. 0.028 0.313 ↑ 85.2 26 1

Nested Loop (cost=1.13..12,034.01 rows=2,216 width=42) (actual time=0.071..0.313 rows=26 loops=1)

27. 0.041 0.215 ↑ 64.6 35 1

Nested Loop (cost=0.84..11,311.68 rows=2,260 width=16) (actual time=0.046..0.215 rows=35 loops=1)

28. 0.023 0.104 ↑ 64.6 35 1

Nested Loop (cost=0.42..9,943.00 rows=2,260 width=12) (actual time=0.038..0.104 rows=35 loops=1)

29. 0.011 0.011 ↑ 64.6 35 1

Seq Scan on saidasnf_pagtos_contasareceber snfpg_cr (cost=0.00..32.60 rows=2,260 width=8) (actual time=0.008..0.011 rows=35 loops=1)

30. 0.070 0.070 ↑ 1.0 1 35

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

  • Index Cond: (codigo = snfpg_cr.saidasnf_pagtos_codigo)
31. 0.070 0.070 ↑ 1.0 1 35

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

  • Index Cond: (codigo = snfpg.codsaidasnf)
32. 0.070 0.070 ↑ 1.0 1 35

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

  • Index Cond: (codigo = snf.codcliente)
  • Filter: ((nome)::text ~~* '%a%'::text)
  • Rows Removed by Filter: 0
33. 0.052 0.052 ↑ 1.0 1 26

Index Scan using contasareceber_pkey1 on contasareceber cr_1 (cost=0.42..7.15 rows=1 width=49) (actual time=0.002..0.002 rows=1 loops=26)

  • Index Cond: (codigo = snfpg_cr.contasareceber_codigo)
34. 0.016 12.455 ↑ 316.6 7 1

Subquery Scan on *SELECT* 3 (cost=1,386.24..15,949.67 rows=2,216 width=140) (actual time=12.424..12.455 rows=7 loops=1)

35. 0.008 12.439 ↑ 316.6 7 1

Hash Left Join (cost=1,386.24..15,927.51 rows=2,216 width=140) (actual time=12.409..12.439 rows=7 loops=1)

  • Hash Cond: (crav.codigo = crav_lot.contasareceber_avulsas_codigo)
36. 0.006 12.428 ↑ 285.7 7 1

Nested Loop (cost=1,325.39..15,861.40 rows=2,000 width=83) (actual time=12.400..12.428 rows=7 loops=1)

37. 0.013 12.394 ↑ 285.7 7 1

Hash Join (cost=1,324.96..1,360.72 rows=2,000 width=38) (actual time=12.391..12.394 rows=7 loops=1)

  • Hash Cond: (crav.clientes_codigo = c_2.codigo)
38. 0.003 0.003 ↑ 291.4 7 1

Seq Scan on contasareceber_avulsas crav (cost=0.00..30.40 rows=2,040 width=12) (actual time=0.002..0.003 rows=7 loops=1)

39. 1.814 12.378 ↓ 1.0 14,493 1

Hash (cost=1,145.78..1,145.78 rows=14,335 width=30) (actual time=12.378..12.378 rows=14,493 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 1029kB
40. 10.564 10.564 ↓ 1.0 14,493 1

Seq Scan on clientes c_2 (cost=0.00..1,145.78 rows=14,335 width=30) (actual time=0.004..10.564 rows=14,493 loops=1)

  • Filter: ((nome)::text ~~* '%a%'::text)
  • Rows Removed by Filter: 129
41. 0.028 0.028 ↑ 1.0 1 7

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

  • Index Cond: (codigo = crav.contasareceber_codigo)
42. 0.000 0.003 ↓ 0.0 0 1

Hash (cost=32.60..32.60 rows=2,260 width=8) (actual time=0.003..0.003 rows=0 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 32kB
43. 0.003 0.003 ↓ 0.0 0 1

Seq Scan on contasareceber_avulsas_contasareceber_avulsas_lotes crav_lot (cost=0.00..32.60 rows=2,260 width=8) (actual time=0.003..0.003 rows=0 loops=1)

44. 189.595 264.773 ↑ 16,400.1 50 1

Sort (cost=107,983.28..110,033.29 rows=820,006 width=12) (actual time=264.761..264.773 rows=50 loops=1)

  • Sort Key: cr_fat.contasareceber_codigo
  • Sort Method: external merge Disk: 20920kB
45. 75.178 75.178 ↓ 1.0 820,007 1

Seq Scan on contasareceber_faturamentos cr_fat (cost=0.00..13,423.06 rows=820,006 width=12) (actual time=0.015..75.178 rows=820,007 loops=1)

46. 0.042 0.042 ↑ 16,400.8 50 1

Index Scan using contasareceber_situacao_pkey on contasareceber_situacao cr_sit (cost=0.42..38,616.64 rows=820,041 width=8) (actual time=0.012..0.042 rows=50 loops=1)

47. 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)
48. 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)
49. 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)
Planning time : 2.803 ms
Execution time : 2,785.515 ms