explain.depesz.com

PostgreSQL's explain analyze made readable

Result: D2bW

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.050 1,155.182 ↑ 1.0 500 1

Limit (cost=86,210.30..86,211.55 rows=500 width=4,402) (actual time=1,155.079..1,155.182 rows=500 loops=1)

2. 138.103 1,155.132 ↑ 66.4 500 1

Sort (cost=86,210.30..86,293.28 rows=33,191 width=4,402) (actual time=1,155.077..1,155.132 rows=500 loops=1)

  • Sort Key: "Remessa".order_arq
  • Sort Method: top-N heapsort Memory: 1724kB
3. 54.169 1,017.029 ↓ 2.3 76,265 1

Hash Left Join (cost=68,060.82..84,556.43 rows=33,191 width=4,402) (actual time=480.430..1,017.029 rows=76,265 loops=1)

  • Hash Cond: ("Remessa".fk_rota_coleta_entrega = "RotaColetaEntrega".codigo)
4. 51.236 962.460 ↓ 2.3 76,265 1

Hash Join (cost=68,018.51..84,426.79 rows=33,191 width=4,395) (actual time=480.025..962.460 rows=76,265 loops=1)

  • Hash Cond: ("Remessa".fk_courier_origem = "CourierOrigem".codigo)
5. 43.211 911.021 ↓ 2.3 76,265 1

Hash Left Join (cost=68,001.39..84,321.18 rows=33,191 width=4,350) (actual time=479.807..911.021 rows=76,265 loops=1)

  • Hash Cond: ("Remessa".fk_courier_coleta = "CourierColeta".codigo)
6. 55.610 867.701 ↓ 2.3 76,265 1

Hash Join (cost=67,984.27..84,216.91 rows=33,191 width=4,305) (actual time=479.694..867.701 rows=76,265 loops=1)

  • Hash Cond: ("Remessa".fk_courier_destino = "CourierDestino".codigo)
7. 49.152 811.926 ↓ 2.3 76,265 1

Hash Left Join (cost=67,967.15..84,111.31 rows=33,191 width=4,260) (actual time=479.515..811.926 rows=76,265 loops=1)

  • Hash Cond: ("Servico".fk_servico_correio = "Servico.ServicoCorreio".codigo)
8. 47.148 762.767 ↓ 2.3 76,265 1

Hash Left Join (cost=67,965.94..83,983.35 rows=33,191 width=4,255) (actual time=479.504..762.767 rows=76,265 loops=1)

  • Hash Cond: ("Servico".fk_etiqueta_termica_economica = "Servico.EtiquetaTermicaRemessaEconomica".codigo)
9. 47.398 715.592 ↓ 2.3 76,265 1

Hash Left Join (cost=67,958.62..83,888.57 rows=33,191 width=3,614) (actual time=479.470..715.592 rows=76,265 loops=1)

  • Hash Cond: ("Servico".fk_etiqueta_termica_expressa = "Servico.EtiquetaTermicaRemessaExpressa".codigo)
10. 37.450 668.169 ↓ 2.3 76,265 1

Hash Left Join (cost=67,951.29..83,793.71 rows=33,191 width=2,973) (actual time=479.440..668.169 rows=76,265 loops=1)

  • Hash Cond: ("Servico".fk_etiqueta_termica_correios_ar = "Servico.EtiquetaTermicaCorreiosAR".codigo)
11. 57.118 630.671 ↓ 2.3 76,265 1

Hash Join (cost=67,943.96..83,698.37 rows=33,191 width=2,332) (actual time=479.378..630.671 rows=76,265 loops=1)

  • Hash Cond: ("Remessa".fk_localidade = "Localidade".codigo)
12. 36.346 567.394 ↓ 2.3 76,265 1

Nested Loop (cost=67,532.22..83,199.47 rows=33,191 width=2,320) (actual time=473.144..567.394 rows=76,265 loops=1)

13. 0.004 0.082 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.27..33.46 rows=1 width=1,409) (actual time=0.070..0.082 rows=1 loops=1)

  • Join Filter: ("Servico".fk_etiqueta_termica_correios = "Servico.EtiquetaTermicaCorreios".codigo)
  • Rows Removed by Join Filter: 44
14. 0.009 0.072 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.27..26.13 rows=1 width=768) (actual time=0.059..0.072 rows=1 loops=1)

  • Join Filter: ("Servico".fk_etiqueta_termica = "Servico.EtiquetaTermica".codigo)
  • Rows Removed by Join Filter: 45
15. 0.003 0.054 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.27..18.81 rows=1 width=127) (actual time=0.042..0.054 rows=1 loops=1)

  • Join Filter: ("Servico".fk_protocolo_recebimento = "Servico.ProtocoloRecebimento".codigo)
  • Rows Removed by Join Filter: 13
16. 0.009 0.048 ↑ 1.0 1 1

Nested Loop (cost=0.27..11.48 rows=1 width=95) (actual time=0.036..0.048 rows=1 loops=1)

  • Join Filter: ("Servico".fk_cliente = "Servico.Cliente".codigo)
  • Rows Removed by Join Filter: 20
17. 0.034 0.034 ↑ 1.0 1 1

Index Scan using "Servico_pkey" on "Servico" (cost=0.27..8.29 rows=1 width=84) (actual time=0.023..0.034 rows=1 loops=1)

  • Index Cond: (codigo = 7)
18. 0.005 0.005 ↑ 2.5 21 1

Seq Scan on "Cliente" "Servico.Cliente" (cost=0.00..2.53 rows=53 width=15) (actual time=0.004..0.005 rows=21 loops=1)

19. 0.003 0.003 ↑ 4.2 14 1

Seq Scan on "TipoEtiquetaFormulario" "Servico.ProtocoloRecebimento" (cost=0.00..6.59 rows=59 width=36) (actual time=0.002..0.003 rows=14 loops=1)

20. 0.009 0.009 ↑ 1.3 46 1

Seq Scan on "TipoEtiquetaFormulario" "Servico.EtiquetaTermica" (cost=0.00..6.59 rows=59 width=645) (actual time=0.001..0.009 rows=46 loops=1)

21. 0.006 0.006 ↑ 1.3 45 1

Seq Scan on "TipoEtiquetaFormulario" "Servico.EtiquetaTermicaCorreios" (cost=0.00..6.59 rows=59 width=645) (actual time=0.002..0.006 rows=45 loops=1)

22. 221.054 530.966 ↓ 2.3 76,265 1

Hash Right Join (cost=67,531.95..82,834.10 rows=33,191 width=915) (actual time=473.071..530.966 rows=76,265 loops=1)

  • Hash Cond: (("Coleta".fk_remessa)::text = ("Remessa".codigo)::text)
23. 34.742 34.742 ↓ 1.0 243,261 1

Seq Scan on "Coleta" (cost=0.00..14,663.59 rows=243,259 width=55) (actual time=0.018..34.742 rows=243,261 loops=1)

24. 71.102 275.170 ↓ 2.3 76,265 1

Hash (cost=67,117.06..67,117.06 rows=33,191 width=872) (actual time=275.170..275.170 rows=76,265 loops=1)

  • Buckets: 131072 (originally 65536) Batches: 1 (originally 1) Memory Usage: 20049kB
25. 204.068 204.068 ↓ 2.3 76,265 1

Index Scan using "Remessa_idx_servico_data_cadastro" on "Remessa" (cost=0.56..67,117.06 rows=33,191 width=872) (actual time=0.048..204.068 rows=76,265 loops=1)

  • Index Cond: ((data_cadastro >= '2020-01-28 00:00:00.841-03'::timestamp with time zone) AND (data_cadastro <= '2020-01-30 23:59:59.841-03'::timestamp with time zone) AND (fk_servico = 7))
26. 3.133 6.159 ↑ 1.0 10,744 1

Hash (cost=277.44..277.44 rows=10,744 width=16) (actual time=6.159..6.159 rows=10,744 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 642kB
27. 3.026 3.026 ↑ 1.0 10,744 1

Seq Scan on "Localidade" (cost=0.00..277.44 rows=10,744 width=16) (actual time=0.014..3.026 rows=10,744 loops=1)

28. 0.019 0.048 ↑ 1.0 59 1

Hash (cost=6.59..6.59 rows=59 width=645) (actual time=0.048..0.048 rows=59 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 44kB
29. 0.029 0.029 ↑ 1.0 59 1

Seq Scan on "TipoEtiquetaFormulario" "Servico.EtiquetaTermicaCorreiosAR" (cost=0.00..6.59 rows=59 width=645) (actual time=0.011..0.029 rows=59 loops=1)

30. 0.013 0.025 ↑ 1.0 59 1

Hash (cost=6.59..6.59 rows=59 width=645) (actual time=0.025..0.025 rows=59 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 44kB
31. 0.012 0.012 ↑ 1.0 59 1

Seq Scan on "TipoEtiquetaFormulario" "Servico.EtiquetaTermicaRemessaExpressa" (cost=0.00..6.59 rows=59 width=645) (actual time=0.002..0.012 rows=59 loops=1)

32. 0.015 0.027 ↑ 1.0 59 1

Hash (cost=6.59..6.59 rows=59 width=645) (actual time=0.027..0.027 rows=59 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 44kB
33. 0.012 0.012 ↑ 1.0 59 1

Seq Scan on "TipoEtiquetaFormulario" "Servico.EtiquetaTermicaRemessaEconomica" (cost=0.00..6.59 rows=59 width=645) (actual time=0.002..0.012 rows=59 loops=1)

34. 0.003 0.007 ↑ 1.0 9 1

Hash (cost=1.09..1.09 rows=9 width=9) (actual time=0.007..0.007 rows=9 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
35. 0.004 0.004 ↑ 1.0 9 1

Seq Scan on "ServicoCorreio" "Servico.ServicoCorreio" (cost=0.00..1.09 rows=9 width=9) (actual time=0.003..0.004 rows=9 loops=1)

36. 0.091 0.165 ↑ 1.0 272 1

Hash (cost=13.72..13.72 rows=272 width=49) (actual time=0.165..0.165 rows=272 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 30kB
37. 0.074 0.074 ↑ 1.0 272 1

Seq Scan on "Courier" "CourierDestino" (cost=0.00..13.72 rows=272 width=49) (actual time=0.003..0.074 rows=272 loops=1)

38. 0.046 0.109 ↑ 1.0 272 1

Hash (cost=13.72..13.72 rows=272 width=49) (actual time=0.109..0.109 rows=272 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 30kB
39. 0.063 0.063 ↑ 1.0 272 1

Seq Scan on "Courier" "CourierColeta" (cost=0.00..13.72 rows=272 width=49) (actual time=0.004..0.063 rows=272 loops=1)

40. 0.087 0.203 ↑ 1.0 272 1

Hash (cost=13.72..13.72 rows=272 width=49) (actual time=0.203..0.203 rows=272 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 30kB
41. 0.116 0.116 ↑ 1.0 272 1

Seq Scan on "Courier" "CourierOrigem" (cost=0.00..13.72 rows=272 width=49) (actual time=0.017..0.116 rows=272 loops=1)

42. 0.177 0.400 ↑ 1.0 1,125 1

Hash (cost=28.25..28.25 rows=1,125 width=11) (actual time=0.400..0.400 rows=1,125 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 64kB
43. 0.223 0.223 ↑ 1.0 1,125 1

Seq Scan on "RotaColetaEntrega" (cost=0.00..28.25 rows=1,125 width=11) (actual time=0.004..0.223 rows=1,125 loops=1)

Planning time : 18.495 ms