explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JMrU

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 236.199 ↓ 17.4 941 1

Hash Left Join (cost=5,831.92..483,579.46 rows=54 width=203) (actual time=70.283..236.199 rows=941 loops=1)

  • Hash Cond: ("Servico".fk_cliente = "Servico.Cliente".codigo)
  • Workers Planned: 4
  • Workers Launched: 4
2. 0.109 47.137 ↓ 17.4 941 1 / 5

Hash Left Join (cost=5,828.73..483,576.11 rows=54 width=168) (actual time=70.258..235.685 rows=941 loops=1)

  • Hash Cond: ("Remessa".fk_courier_destino = "CourierDestino".codigo)
3. 0.134 47.028 ↓ 17.4 941 1 / 5

Hash Left Join (cost=5,812.05..483,559.29 rows=54 width=130) (actual time=70.177..235.142 rows=941 loops=1)

  • Hash Cond: ("Remessa".fk_courier_com_a_remessa = "LocalCourier".codigo)
4. 0.800 46.894 ↓ 17.4 941 1 / 5

Nested Loop (cost=5,795.36..483,542.46 rows=54 width=92) (actual time=70.065..234.472 rows=941 loops=1)

5. 0.000 46.094 ↓ 17.1 941 1 / 5

Bitmap Heap Scan on "Remessa" (cost=5,795.09..483,310.61 rows=55 width=71) (actual time=70.042..230.472 rows=941 loops=1)

6. 53,519.712 53,519.712 ↓ 1.0 559,185 1 / 5

Recheck Cond: (fk_situacao_remessa = ANY ('{"Gather Merge (cost=1,350,837.99..1,414,672.35 rows=533,132 width=2,206) (actual time=266,710.874..267,598.562 rows=559,185 loops=1)

7. 1,416.361 266,608.057 ↑ 1.2 111,837 5 / 5

Sort (cost=1,349,837.93..1,350,171.14 rows=133,283 width=2,206) (actual time=266,592.838..266,608.057 rows=111,837 loops=5)

  • Sort Key: "Remessa".codigo DESC
  • Sort Method: quicksort Memory: 72608kB
8. 358.702 265,191.681 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=30,359.42..1,338,492.79 rows=133,283 width=2,206) (actual time=283.340..265,191.681 rows=111,837 loops=5)

  • Hash Cond: (("Remessa".codigo)::text = ("Coleta".fk_remessa)::text)
9. 305.798 264,585.772 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=12,768.44..1,320,383.94 rows=133,283 width=2,105) (actual time=35.198..264,585.772 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_courier_destino = "CourierDestino".codigo)
10. 267.990 264,279.865 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=12,751.76..1,320,012.39 rows=133,283 width=2,098) (actual time=35.074..264,279.865 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_courier_coleta = "CourierColeta".codigo)
11. 295.996 264,011.715 ↑ 1.2 111,837 5 / 5

Hash Join (cost=12,735.08..1,319,645.77 rows=133,283 width=2,049) (actual time=34.901..264,011.715 rows=111,837 loops=5)

  • Hash Cond: ("Servico".fk_cliente = "Servico.Cliente".codigo)
12. 308.121 263,715.655 ↑ 1.2 111,837 5 / 5

Hash Join (cost=12,731.89..1,319,264.73 rows=133,283 width=2,014) (actual time=34.742..263,715.655 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_servico = "Servico".codigo)
13. 303.699 263,406.768 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=12,611.34..1,318,786.98 rows=133,283 width=1,989) (actual time=33.965..263,406.768 rows=111,837 loops=5)

  • Hash Cond: ("UltimaOcorrenciaRastreamento".fk_situacao_remessa = "UltimaOcorrenciaRastreamento.SituacaoRemessa".codigo)
14. 308.601 263,103.045 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=12,609.58..1,318,391.74 rows=133,283 width=1,972) (actual time=33.930..263,103.045 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_ultima_ocorrencia_rastreamento = "UltimaOcorrenciaRastreamento".codigo)
15. 294.770 262,794.371 ↑ 1.2 111,837 5 / 5

Hash Join (cost=12,603.56..1,318,024.78 rows=133,283 width=1,935) (actual time=33.846..262,794.371 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_prioridade = "PrioridadeRemessa".codigo)
16. 297.180 262,499.578 ↑ 1.2 111,837 5 / 5

Hash Join (cost=12,602.52..1,316,932.48 rows=133,283 width=1,925) (actual time=33.804..262,499.578 rows=111,837 loops=5)

  • Hash Cond: ("Localidade".fk_classificacao_localidade = "Localidade.ClassificacaoLocalidade".codigo)
17. 339.729 262,202.383 ↑ 1.2 111,837 5 / 5

Hash Join (cost=12,601.45..1,316,087.28 rows=133,283 width=1,915) (actual time=33.777..262,202.383 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_localidade = "Localidade".codigo)
18. 258.935 261,855.646 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=12,189.71..1,315,325.54 rows=133,283 width=1,899) (actual time=26.699..261,855.646 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_parentesco_final = "ParentescoFinal".codigo)
19. 230.585 261,596.676 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=12,188.08..1,314,945.43 rows=133,283 width=1,890) (actual time=26.649..261,596.676 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_ocorrencia_devolucao = "Devolucao".codigo)
20. 284.931 261,366.028 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=12,182.06..1,314,588.87 rows=133,283 width=1,857) (actual time=26.569..261,366.028 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".entregador_final = "Entregador".codigo)
21. 236.289 261,055.817 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=89.58..1,302,146.39 rows=133,283 width=1,832) (actual time=1.247..261,055.817 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_ultimo_motivo_tratativa = "UltimoMotivoTrativa".codigo)
22. 244.044 260,819.473 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=83.56..1,301,789.90 rows=133,283 width=1,799) (actual time=1.178..260,819.473 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_tratativa = "SituacaoTratativa".codigo)
23. 299.671 260,575.341 ↑ 1.2 111,837 5 / 5

Hash Join (cost=77.55..1,301,433.96 rows=133,283 width=1,766) (actual time=1.074..260,575.341 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_tipo_remessa = "TipoRemessa".codigo)
24. 583.213 260,275.634 ↑ 1.2 111,837 5 / 5

Hash Left Join (cost=76.44..1,300,786.42 rows=133,283 width=1,759) (actual time=1.018..260,275.634 rows=111,837 loops=5)

  • Hash Cond: ("Remessa".fk_centro_custo = "CentroCustoCliente".codigo)
25. 259,691.466 259,691.466 ↑ 1.2 111,837 5 / 5

Parallel Seq Scan on "Remessa" (cost=0.00..1,300,360.07 rows=133,283 width=1,733) (actual time=0.033..259,691.466 rows=111,837 loops=5)

  • Filter: ((data_coleta >= '2020-01-01 00:00:00-03'::timestamp with time zone) AND (data_coleta <= '2020-01-31 23:59:00-03'::timestamp with time zone))
  • Rows Removed by Filter: 3401627
26. 0.499 0.955 ↑ 1.0 2,286 5 / 5

Hash (cost=47.86..47.86 rows=2,286 width=30) (actual time=0.955..0.955 rows=2,286 loops=5)

  • Buckets: 4096 Batches: 1 Memory Usage: 176kB
27. 0.456 0.456 ↑ 1.0 2,286 5 / 5

Seq Scan on "CentroCustoCliente" (cost=0.00..47.86 rows=2,286 width=30) (actual time=0.019..0.456 rows=2,286 loops=5)

28. 0.007 0.036 ↑ 1.0 5 5 / 5

Hash (cost=1.05..1.05 rows=5 width=11) (actual time=0.036..0.036 rows=5 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
29. 0.029 0.029 ↑ 1.0 5 5 / 5

Seq Scan on "TipoRemessa" (cost=0.00..1.05 rows=5 width=11) (actual time=0.028..0.029 rows=5 loops=5)

30. 0.033 0.088 ↑ 1.0 134 5 / 5

Hash (cost=4.34..4.34 rows=134 width=37) (actual time=0.088..0.088 rows=134 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
31. 0.055 0.055 ↑ 1.0 134 5 / 5

Seq Scan on "Ocorrencia" "SituacaoTratativa" (cost=0.00..4.34 rows=134 width=37) (actual time=0.021..0.055 rows=134 loops=5)

32. 0.031 0.055 ↑ 1.0 134 5 / 5

Hash (cost=4.34..4.34 rows=134 width=37) (actual time=0.055..0.055 rows=134 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
33. 0.024 0.024 ↑ 1.0 134 5 / 5

Seq Scan on "Ocorrencia" "UltimoMotivoTrativa" (cost=0.00..4.34 rows=134 width=37) (actual time=0.003..0.024 rows=134 loops=5)

34. 0.980 25.280 ↑ 1.8 3,573 5 / 5

Hash (cost=12,010.55..12,010.55 rows=6,555 width=29) (actual time=25.280..25.280 rows=3,573 loops=5)

  • Buckets: 8192 Batches: 1 Memory Usage: 285kB
35. 24.300 24.300 ↑ 1.8 3,573 5 / 5

Seq Scan on "Entregador" (cost=0.00..12,010.55 rows=6,555 width=29) (actual time=0.018..24.300 rows=3,573 loops=5)

36. 0.031 0.063 ↑ 1.0 134 5 / 5

Hash (cost=4.34..4.34 rows=134 width=37) (actual time=0.063..0.063 rows=134 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
37. 0.032 0.032 ↑ 1.0 134 5 / 5

Seq Scan on "Ocorrencia" "Devolucao" (cost=0.00..4.34 rows=134 width=37) (actual time=0.008..0.032 rows=134 loops=5)

38. 0.011 0.035 ↑ 1.0 28 5 / 5

Hash (cost=1.28..1.28 rows=28 width=13) (actual time=0.035..0.035 rows=28 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
39. 0.024 0.024 ↑ 1.0 28 5 / 5

Seq Scan on "GrauRelacionamento" "ParentescoFinal" (cost=0.00..1.28 rows=28 width=13) (actual time=0.020..0.024 rows=28 loops=5)

40. 3.173 7.008 ↑ 1.0 10,744 5 / 5

Hash (cost=277.44..277.44 rows=10,744 width=20) (actual time=7.008..7.008 rows=10,744 loops=5)

  • Buckets: 16384 Batches: 1 Memory Usage: 700kB
41. 3.835 3.835 ↑ 1.0 10,744 5 / 5

Seq Scan on "Localidade" (cost=0.00..277.44 rows=10,744 width=20) (actual time=0.011..3.835 rows=10,744 loops=5)

42. 0.004 0.015 ↑ 1.0 3 5 / 5

Hash (cost=1.03..1.03 rows=3 width=14) (actual time=0.015..0.015 rows=3 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
43. 0.011 0.011 ↑ 1.0 3 5 / 5

Seq Scan on "ClassificacaoLocalidade" "Localidade.ClassificacaoLocalidade" (cost=0.00..1.03 rows=3 width=14) (actual time=0.008..0.011 rows=3 loops=5)

44. 0.003 0.023 ↑ 1.0 2 5 / 5

Hash (cost=1.02..1.02 rows=2 width=14) (actual time=0.023..0.023 rows=2 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
45. 0.020 0.020 ↑ 1.0 2 5 / 5

Seq Scan on "PrioridadeRemessa" (cost=0.00..1.02 rows=2 width=14) (actual time=0.019..0.020 rows=2 loops=5)

46. 0.031 0.073 ↑ 1.0 134 5 / 5

Hash (cost=4.34..4.34 rows=134 width=41) (actual time=0.073..0.073 rows=134 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
47. 0.042 0.042 ↑ 1.0 134 5 / 5

Seq Scan on "Ocorrencia" "UltimaOcorrenciaRastreamento" (cost=0.00..4.34 rows=134 width=41) (actual time=0.003..0.042 rows=134 loops=5)

48. 0.012 0.024 ↑ 1.0 34 5 / 5

Hash (cost=1.34..1.34 rows=34 width=21) (actual time=0.024..0.024 rows=34 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
49. 0.012 0.012 ↑ 1.0 34 5 / 5

Seq Scan on "SituacaoRemessa" "UltimaOcorrenciaRastreamento.SituacaoRemessa" (cost=0.00..1.34 rows=34 width=21) (actual time=0.007..0.012 rows=34 loops=5)

50. 0.060 0.766 ↑ 1.0 202 5 / 5

Hash (cost=118.02..118.02 rows=202 width=29) (actual time=0.766..0.766 rows=202 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
51. 0.706 0.706 ↑ 1.0 202 5 / 5

Seq Scan on "Servico" (cost=0.00..118.02 rows=202 width=29) (actual time=0.016..0.706 rows=202 loops=5)

52. 0.016 0.064 ↑ 1.0 53 5 / 5

Hash (cost=2.53..2.53 rows=53 width=39) (actual time=0.064..0.064 rows=53 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
53. 0.048 0.048 ↑ 1.0 53 5 / 5

Seq Scan on "Cliente" "Servico.Cliente" (cost=0.00..2.53 rows=53 width=39) (actual time=0.031..0.048 rows=53 loops=5)

54. 0.068 0.160 ↑ 1.1 272 5 / 5

Hash (cost=12.97..12.97 rows=297 width=49) (actual time=0.160..0.160 rows=272 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 30kB
55. 0.092 0.092 ↑ 1.1 272 5 / 5

Seq Scan on "Courier" "CourierColeta" (cost=0.00..12.97 rows=297 width=49) (actual time=0.013..0.092 rows=272 loops=5)

56. 0.056 0.109 ↑ 1.1 272 5 / 5

Hash (cost=12.97..12.97 rows=297 width=11) (actual time=0.109..0.109 rows=272 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 20kB
57. 0.053 0.053 ↑ 1.1 272 5 / 5

Seq Scan on "Courier" "CourierDestino" (cost=0.00..12.97 rows=297 width=11) (actual time=0.003..0.053 rows=272 loops=5)

58. 110.645 247.187 ↓ 1.0 238,304 5 / 5

Hash (cost=14,613.21..14,613.21 rows=238,221 width=105) (actual time=247.187..247.187 rows=238,304 loops=5)

  • Buckets: 262144 Batches: 1 Memory Usage: 35830kB
59. 129.791 135.977 ↓ 1.0 238,304 5 / 5

Seq Scan on "Coleta" (cost=0.00..14,613.21 rows=238,221 width=105) (actual time=0.034..135.977 rows=238,304 loops=5)

  • Filter: ((fk_ocorrencia_devolucao IS NULL) AND (NOT postagem) AND (fk_ultima_ocorrencia_rastreamento <> 78) AND (data_prevista_entrega_reversa >= '2020-01-03 00:00:00-03'::timestamp with time zone) AND (data_prevista_entrega_reversa <= '2020-02-13 23:59:00-03'::timestamp with time zone) AND ((fk_courier_destino = 96) OR (fk_courier_destino1 = 96) OR (fk_courier_coleta = 96)))
  • Rows Removed by Filter: 128008
  • Heap Blocks: exact=80322
60. 6.186 6.186 ↑ 1.3 131,859 1 / 5

Bitmap Index Scan on idx_remessa_situacao_tipo_remessa_data_coleta (cost=0.00..5,795.08 rows=173,140 width=0) (actual time=30.929..30.929 rows=131,859 loops=1)

  • Index Cond: (fk_situacao_remessa = ANY ('{9,13,14,11,15,17,10,21}'::integer[]))
61. 0.565 0.565 ↑ 1.0 1 941 / 5

Index Scan using "Servico_pkey" on "Servico" (cost=0.27..4.21 rows=1 width=29) (actual time=0.003..0.003 rows=1 loops=941)

  • Index Cond: (codigo = "Remessa".fk_servico)
  • Filter: (show_dashboard IS NOT FALSE)
62. 0.009 0.020 ↑ 1.1 272 1 / 5

Hash (cost=12.97..12.97 rows=297 width=42) (actual time=0.102..0.102 rows=272 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
63. 0.012 0.012 ↑ 1.1 272 1 / 5

Seq Scan on "Courier" "LocalCourier" (cost=0.00..12.97 rows=297 width=42) (actual time=0.010..0.058 rows=272 loops=1)

64. 0.008 0.015 ↑ 1.1 272 1 / 5

Hash (cost=12.97..12.97 rows=297 width=42) (actual time=0.077..0.077 rows=272 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
65. 0.008 0.008 ↑ 1.1 272 1 / 5

Seq Scan on "Courier" "CourierDestino" (cost=0.00..12.97 rows=297 width=42) (actual time=0.002..0.038 rows=272 loops=1)

66. 0.002 0.004 ↑ 1.0 53 1 / 5

Hash (cost=2.53..2.53 rows=53 width=39) (actual time=0.020..0.020 rows=53 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
67. 0.002 0.002 ↑ 1.0 53 1 / 5

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

Planning time : 9.136 ms