explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hovg

Settings
# exclusive inclusive rows x rows loops node
1. 0.823 4,472.264 ↑ 1.0 1 1

Aggregate (cost=6,839.31..6,839.32 rows=1 width=8) (actual time=4,472.264..4,472.264 rows=1 loops=1)

  • Execution time: 4,472.608 ms(42 registros)
2. 2.730 4,471.441 ↓ 12,301.0 12,301 1

Unique (cost=6,839.29..6,839.30 rows=1 width=45) (actual time=4,467.403..4,471.441 rows=12,301 loops=1)

3. 76.563 4,468.711 ↓ 15,116.0 15,116 1

Sort (cost=6,839.29..6,839.30 rows=1 width=45) (actual time=4,467.403..4,468.711 rows=15,116 loops=1)

  • Sort Key: n.chave_acesso
  • Sort Method: quicksort Memory: 1,565kB
4. 14.757 4,392.148 ↓ 15,116.0 15,116 1

Nested Loop Left Join (cost=2,593.14..6,839.28 rows=1 width=45) (actual time=16.617..4,392.148 rows=15,116 loops=1)

5. 91.164 4,130.591 ↓ 12,340.0 12,340 1

Nested Loop (cost=2,592.72..6,838.29 rows=1 width=64) (actual time=16.584..4,130.591 rows=12,340 loops=1)

  • Join Filter: (pessoa.uf = uf.sigla)
  • Rows Removed by Join Filter: 333,180
6. 14.285 3,990.067 ↓ 12,340.0 12,340 1

Nested Loop (cost=2,592.72..6,836.66 rows=1 width=66) (actual time=16.577..3,990.067 rows=12,340 loops=1)

7. 0.000 51.662 ↓ 12,340.0 12,340 1

Gather (cost=2,592.29..6,831.39 rows=1 width=37) (actual time=16.549..51.662 rows=12,340 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
8. 10.460 96.851 ↓ 6,170.0 6,170 2 / 2

Nested Loop (cost=1,592.29..5,831.29 rows=1 width=37) (actual time=12.625..96.851 rows=6,170 loops=2)

9. 19.297 43.201 ↓ 3.3 6,170 2 / 2

Hash Join (cost=1,591.87..3,967.81 rows=1,881 width=62) (actual time=12.577..43.201 rows=6,170 loops=2)

  • Hash Cond: (nr.nfe = md.nfe)
10. 12.072 12.072 ↑ 1.2 45,934 2 / 2

Parallel Seq Scan on nfe_resumo nr (cost=0.00..2,152.28 rows=54,628 width=54) (actual time=0.027..12.072 rows=45,934 loops=2)

11. 2.173 11.832 ↓ 3.8 12,340 2 / 2

Hash (cost=1,551.72..1,551.72 rows=3,212 width=8) (actual time=11.832..11.832 rows=12,340 loops=2)

  • Buckets: 16,384 (originally 4096) Batches: 1 (originally 1) Memory Usage: 611kB
12. 8.182 9.659 ↓ 3.8 12,340 2 / 2

Bitmap Heap Scan on nfe_manifestacao md (cost=262.25..1,551.72 rows=3,212 width=8) (actual time=1.616..9.659 rows=12,340 loops=2)

  • Recheck Cond: ((nfe_evento = 0) OR (nfe_evento = 210,210))
  • Filter: (COALESCE(visualiza, true) AND COALESCE(visualiza, true) AND (situacao_nfe = 1))
  • Rows Removed by Filter: 879
  • Heap Blocks: exact=971
13. 0.000 1.477 ↓ 0.0 0 2 / 2

BitmapOr (cost=262.25..262.25 rows=13,341 width=0) (actual time=1.477..1.477 rows=0 loops=2)

14. 1.061 1.061 ↓ 1.1 11,497 2 / 2

Bitmap Index Scan on nfe_evento_ix (cost=0.00..196.03 rows=10,098 width=0) (actual time=1.061..1.061 rows=11,497 loops=2)

  • Index Cond: (nfe_evento = 0)
15. 0.416 0.416 ↓ 1.5 4,890 2 / 2

Bitmap Index Scan on nfe_evento_ix (cost=0.00..64.61 rows=3,243 width=0) (actual time=0.416..0.416 rows=4,890 loops=2)

  • Index Cond: (nfe_evento = 210,210)
16. 43.190 43.190 ↑ 1.0 1 12,340 / 2

Index Scan using pessoa_pkey on pessoa (cost=0.42..0.98 rows=1 width=25) (actual time=0.007..0.007 rows=1 loops=12,340)

  • Index Cond: (grid = nr.empresa)
  • Filter: ((tipo ~~ '%%E%%'::text) AND (flag = 'A'::bpchar) AND (nr.destinatario_cpf = cpf))
17. 3,924.120 3,924.120 ↑ 1.0 1 12,340

Index Scan using nfe_pkey on nfe n (cost=0.43..5.25 rows=1 width=53) (actual time=0.318..0.318 rows=1 loops=12,340)

  • Index Cond: (grid = nr.nfe)
  • Filter: ("substring"(chave_acesso, 21, 2) = '55'::text)
18. 49.360 49.360 ↑ 1.0 28 12,340

Seq Scan on unidade_federativa uf (cost=0.00..1.28 rows=28 width=3) (actual time=0.002..0.004 rows=28 loops=12,340)

19. 246.800 246.800 ↑ 1.0 1 12,340

Index Scan using pessoa_cpf_ix on pessoa pessoa_1 (cost=0.42..0.99 rows=1 width=15) (actual time=0.019..0.020 rows=1 loops=12,340)

  • Index Cond: (nr.emitente_cpf = cpf)
  • Filter: (tipo ~~ '%%F%%'::text)
  • Rows Removed by Filter: 0
Planning time : 4.394 ms