explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3dVr : Optimization for: plan #LKPJ

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.011 432,366.029 ↓ 15.0 15 1

Limit (cost=161,409.13..161,409.16 rows=1 width=118) (actual time=432,365.992..432,366.029 rows=15 loops=1)

2. 0.025 432,366.018 ↓ 15.0 15 1

Group (cost=161,409.13..161,409.16 rows=1 width=118) (actual time=432,365.990..432,366.018 rows=15 loops=1)

3. 64.742 432,365.993 ↓ 15.0 15 1

Sort (cost=161,409.13..161,409.13 rows=1 width=118) (actual time=432,365.986..432,365.993 rows=15 loops=1)

  • Sort Key: agendament0_.oid_agendamento_entrega, agendament0_.situacao, empresa9_.nm_empresa, pessoa8_.nm_razao_social, transporta1_.nome, notafiscal3_.nm_serie, notafiscal3_.nr_nota_fiscal, notafiscal3_.oid_nota_fiscal, conhecimen7_.oid_conhecimento, agendament0_.dataagendamento, conhecimen7_.dt_entrega, conhecimen7_.situacao
  • Sort Method: external merge Disk: 2320kB
4. 63.247 432,301.251 ↓ 17,341.0 17,341 1

Nested Loop (cost=14,754.66..161,409.12 rows=1 width=118) (actual time=242.541..432,301.251 rows=17,341 loops=1)

5. 46.716 432,047.253 ↓ 17,341.0 17,341 1

Nested Loop (cost=14,754.66..161,405.86 rows=1 width=117) (actual time=242.531..432,047.253 rows=17,341 loops=1)

6. 54.689 431,861.809 ↓ 17,341.0 17,341 1

Nested Loop (cost=14,754.23..161,397.89 rows=1 width=100) (actual time=242.509..431,861.809 rows=17,341 loops=1)

  • Join Filter: (conhecimen6_.oid_conhecimento = conhecimen7_.oid_conhecimento)
7. 54.735 431,755.097 ↓ 17,341.0 17,341 1

Nested Loop (cost=14,753.79..161,390.17 rows=1 width=106) (actual time=242.501..431,755.097 rows=17,341 loops=1)

  • Join Filter: (conhecimen6_.oid_conhecimento = conhecimen5_.oid_conhecimento)
8. 65.615 431,509.611 ↓ 17,341.0 17,341 1

Nested Loop (cost=14,753.36..161,382.45 rows=1 width=98) (actual time=242.468..431,509.611 rows=17,341 loops=1)

  • Join Filter: (notasfisca2_.oid_nota_fiscal = notafiscal3_.oid_nota_fiscal)
9. 198,195.929 431,235.904 ↓ 17,341.0 17,341 1

Nested Loop (cost=14,752.92..161,374.74 rows=1 width=96) (actual time=242.439..431,235.904 rows=17,341 loops=1)

  • Join Filter: (agendament0_.oid_transportadora = transporta1_.oid_transportadora)
  • Rows Removed by Join Filter: 474293691
10. 59.755 878.667 ↓ 17,341.0 17,341 1

Nested Loop (cost=14,752.92..160,284.53 rows=1 width=74) (actual time=239.296..878.667 rows=17,341 loops=1)

  • Join Filter: (conhecimen6_.oid_conhecimento = conhecimen4_.oid_conhecimento)
  • Rows Removed by Join Filter: 1870
11. 295.702 626.918 ↑ 1.0 17,454 1

Hash Join (cost=14,752.49..20,257.13 rows=18,118 width=58) (actual time=239.253..626.918 rows=17,454 loops=1)

  • Hash Cond: (notasfisca2_.oid_agendamento_entrega = agendament0_.oid_agendamento_entrega)
12. 91.999 91.999 ↑ 1.0 182,153 1

Seq Scan on nota_fiscal_agend_entrega notasfisca2_ (cost=0.00..2,812.88 rows=182,588 width=16) (actual time=0.007..91.999 rows=182,153 loops=1)

13. 11.017 239.217 ↑ 1.0 17,454 1

Hash (cost=14,533.89..14,533.89 rows=17,488 width=58) (actual time=239.217..239.217 rows=17,454 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 1637kB
14. 124.424 228.200 ↑ 1.0 17,454 1

Hash Join (cost=9,390.42..14,533.89 rows=17,488 width=58) (actual time=24.293..228.200 rows=17,454 loops=1)

  • Hash Cond: (conhecimen6_.oid_agendamento_entrega = agendament0_.oid_agendamento_entrega)
15. 79.512 79.512 ↓ 1.0 178,146 1

Seq Scan on conhecimento_agend_entrega conhecimen6_ (cost=0.00..2,743.26 rows=178,026 width=16) (actual time=0.006..79.512 rows=178,146 loops=1)

16. 10.216 24.264 ↓ 1.0 17,454 1

Hash (cost=9,174.01..9,174.01 rows=17,313 width=42) (actual time=24.264..24.264 rows=17,454 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 1364kB
17. 12.284 14.048 ↓ 1.0 17,454 1

Bitmap Heap Scan on agendamento_entrega agendament0_ (cost=546.60..9,174.01 rows=17,313 width=42) (actual time=1.953..14.048 rows=17,454 loops=1)

  • Recheck Cond: (oid_empresa = 27::bigint)
18. 1.764 1.764 ↓ 1.0 17,454 1

Bitmap Index Scan on idx_agendamento_entrega_empresa (cost=0.00..542.27 rows=17,313 width=0) (actual time=1.764..1.764 rows=17,454 loops=1)

  • Index Cond: (oid_empresa = 27::bigint)
19. 191.994 191.994 ↑ 1.0 1 17,454

Index Scan using idx_nota_fiscal_conhecimento_oid_nota_fiscal on nota_fiscal_conhecimento conhecimen4_ (cost=0.43..7.72 rows=1 width=16) (actual time=0.009..0.011 rows=1 loops=17,454)

  • Index Cond: (oid_nota_fiscal = notasfisca2_.oid_nota_fiscal)
20. 232,161.308 232,161.308 ↑ 1.0 27,352 17,341

Seq Scan on transportadora transporta1_ (cost=0.00..747.87 rows=27,387 width=38) (actual time=0.003..13.388 rows=27,352 loops=17,341)

21. 208.092 208.092 ↑ 1.0 1 17,341

Index Scan using pk_nota_fiscal on nota_fiscal notafiscal3_ (cost=0.43..7.70 rows=1 width=18) (actual time=0.011..0.012 rows=1 loops=17,341)

  • Index Cond: (oid_nota_fiscal = conhecimen4_.oid_nota_fiscal)
22. 190.751 190.751 ↑ 1.0 1 17,341

Index Only Scan using pk_conhecimento on conhecimento conhecimen5_ (cost=0.43..7.70 rows=1 width=8) (actual time=0.010..0.011 rows=1 loops=17,341)

  • Index Cond: (oid_conhecimento = conhecimen4_.oid_conhecimento)
  • Heap Fetches: 17341
23. 52.023 52.023 ↑ 1.0 1 17,341

Index Scan using pk_conhecimento on conhecimento conhecimen7_ (cost=0.43..7.70 rows=1 width=18) (actual time=0.002..0.003 rows=1 loops=17,341)

  • Index Cond: (oid_conhecimento = conhecimen5_.oid_conhecimento)
24. 138.728 138.728 ↑ 1.0 1 17,341

Index Scan using pk_pessoa on pessoa pessoa8_ (cost=0.43..7.96 rows=1 width=33) (actual time=0.007..0.008 rows=1 loops=17,341)

  • Index Cond: (oid_pessoa = agendament0_.oid_destinatario)
25. 190.751 190.751 ↑ 1.0 1 17,341

Seq Scan on empresa empresa9_ (cost=0.00..3.25 rows=1 width=17) (actual time=0.004..0.011 rows=1 loops=17,341)

  • Filter: (oid_empresa = 27::bigint)
  • Rows Removed by Filter: 101