explain.depesz.com

PostgreSQL's explain analyze made readable

Result: caQX : Optimization for: nfce; plan #QRhV

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.002 0.529 ↓ 22.5 45 1

Limit (cost=8.55..8.63 rows=2 width=729) (actual time=0.487..0.529 rows=45 loops=1)

  • Buffers: shared hit=376
2. 0.086 0.527 ↓ 22.5 45 1

Aggregate (cost=8.55..8.63 rows=2 width=729) (actual time=0.487..0.527 rows=45 loops=1)

  • Buffers: shared hit=376
3. 0.059 0.441 ↓ 36.0 72 1

Sort (cost=8.55..8.55 rows=2 width=704) (actual time=0.437..0.441 rows=72 loops=1)

  • Sort Key: documentoeletronicoven.dt_cadastro DESC, documentoeletronicoven.nr_documento DESC, documentoeletronicoven.nr_serie, documentoeletronicochaveven.tx_chave, documentoeletronicoven.cd_status, documentoeletronicoeventoven.cd_situacao, documentoeletronicoeventoven.tx_motivo, vendapdv.id_vendapdv, integracaovendaven.fl_integrado
  • Sort Method: quicksort Memory: 44kB
  • Buffers: shared hit=376
4. 0.026 0.382 ↓ 36.0 72 1

Hash Join (cost=5.3..8.54 rows=2 width=704) (actual time=0.352..0.382 rows=72 loops=1)

  • Buffers: shared hit=376
5. 0.033 0.033 ↑ 1.0 89 1

Seq Scan on tb_vendaitempdv vendaitempdv (cost=0..2.89 rows=89 width=12) (actual time=0.023..0.033 rows=89 loops=1)

  • Buffers: shared hit=2
6. 0.016 0.323 ↓ 45.0 45 1

Hash (cost=5.28..5.28 rows=1 width=737) (actual time=0.323..0.323 rows=45 loops=1)

  • Buffers: shared hit=374
7. 0.007 0.307 ↓ 45.0 45 1

Nested Loop (cost=2.42..5.28 rows=1 width=737) (actual time=0.077..0.307 rows=45 loops=1)

  • Buffers: shared hit=374
8. 0.017 0.255 ↓ 45.0 45 1

Nested Loop (cost=2.28..4.86 rows=1 width=691) (actual time=0.073..0.255 rows=45 loops=1)

  • Buffers: shared hit=284
9. 0.006 0.191 ↓ 47.0 47 1

Nested Loop (cost=2.14..4.43 rows=1 width=682) (actual time=0.059..0.191 rows=47 loops=1)

  • Buffers: shared hit=190
10. 0.010 0.138 ↓ 47.0 47 1

Nested Loop (cost=2..4 rows=1 width=654) (actual time=0.055..0.138 rows=47 loops=1)

  • Buffers: shared hit=96
11. 0.038 0.081 ↓ 47.0 47 1

Hash Join (cost=1.86..3.58 rows=1 width=614) (actual time=0.047..0.081 rows=47 loops=1)

  • Buffers: shared hit=2
12. 0.010 0.010 ↑ 1.0 47 1

Seq Scan on tb_documentoeletrven documentoeletronicoven (cost=0..1.47 rows=47 width=66) (actual time=0.008..0.01 rows=47 loops=1)

  • Buffers: shared hit=1
13. 0.010 0.033 ↓ 15.7 47 1

Hash (cost=1.82..1.82 rows=3 width=560) (actual time=0.033..0.033 rows=47 loops=1)

  • Buffers: shared hit=1
14. 0.023 0.023 ↓ 15.7 47 1

Seq Scan on tb_documentoeletreventoven documentoeletronicoeventoven (cost=0..1.82 rows=3 width=560) (actual time=0.01..0.023 rows=47 loops=1)

  • Filter: ((documentoeletronicoeventoven.cd_evento = '2'::numeric) OR (documentoeletronicoeventoven.cd_evento = '3'::numeric) OR (documentoeletronicoeventoven.cd_evento = '1'::numeric))
  • Buffers: shared hit=1
15. 0.047 0.047 ↑ 1.0 1 47

Index Scan using documentoeletrvendaven_pk on tb_documentoeletrvendaven documentoeletronicovendaven (cost=0.14..0.41 rows=1 width=40) (actual time=0.001..0.001 rows=1 loops=47)

  • Index Cond: (documentoeletronicovendaven.cd_documentoeletrven = documentoeletronicoven.id_documentoeletrven)
  • Buffers: shared hit=94
16. 0.047 0.047 ↑ 1.0 1 47

Index Scan using integracaovendaven_pk on tb_integracaovendaven integracaovendaven (cost=0.14..0.41 rows=1 width=28) (actual time=0.001..0.001 rows=1 loops=47)

  • Index Cond: (integracaovendaven.cd_vendapdv = documentoeletronicovendaven.cd_vendaven)
  • Buffers: shared hit=94
17. 0.047 0.047 ↑ 1.0 1 47

Index Scan using vendapdv_pk on tb_vendapdv vendapdv (cost=0.14..0.42 rows=1 width=9) (actual time=0.001..0.001 rows=1 loops=47)

  • Index Cond: (vendapdv.id_vendapdv = documentoeletronicovendaven.cd_vendaven)
  • Filter: ((vendapdv.dt_movimento >= '2019-11-22'::date) AND (vendapdv.dt_movimento <= '2019-11-27'::date) AND (vendapdv.cd_pdv = '1'::numeric) AND (vendapdv.cd_empresa = '1'::numeric))
  • Buffers: shared hit=94
18. 0.045 0.045 ↑ 1.0 1 45

Index Scan using documentoeletrchaveven_pk on tb_documentoeletrchaveven documentoeletronicochaveven (cost=0.14..0.41 rows=1 width=126) (actual time=0.001..0.001 rows=1 loops=45)

  • Index Cond: (documentoeletronicochaveven.cd_documentoeletrven = documentoeletronicovendaven.cd_documentoeletrven)
  • Buffers: shared hit=90
Planning time : 7.631 ms
Execution time : 0.638 ms