explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4UYY

Settings
# exclusive inclusive rows x rows loops node
1. 0.021 645.831 ↑ 1.0 10 1

Limit (cost=2.70..3,281.73 rows=10 width=197) (actual time=31.410..645.831 rows=10 loops=1)

2. 0.219 645.810 ↑ 64.7 10 1

WindowAgg (cost=2.70..212,155.99 rows=647 width=197) (actual time=31.409..645.810 rows=10 loops=1)

3. 0.033 636.901 ↑ 64.7 10 1

Nested Loop Left Join (cost=2.70..206,946.02 rows=647 width=119) (actual time=31.280..636.901 rows=10 loops=1)

  • Join Filter: (ape.cd_pessoa = cf.cd_pessoa_adm_pgto_eletronico)
  • Rows Removed by Join Filter: 73
4. 0.177 636.848 ↑ 64.7 10 1

Nested Loop Left Join (cost=2.70..206,850.18 rows=647 width=112) (actual time=31.266..636.848 rows=10 loops=1)

  • Join Filter: (c.cd_agencia = a.cd_agencia)
  • Rows Removed by Join Filter: 1550
5. 0.055 636.471 ↑ 64.7 10 1

Nested Loop Semi Join (cost=2.70..205,055.67 rows=647 width=103) (actual time=31.173..636.471 rows=10 loops=1)

  • Join Filter: (c.cd_ctrc = cfp.cd_ctrc)
6. 0.051 633.976 ↑ 83.2 10 1

Nested Loop (cost=2.27..204,641.99 rows=832 width=103) (actual time=31.137..633.976 rows=10 loops=1)

7. 0.054 633.795 ↑ 83.2 10 1

Nested Loop (cost=1.84..202,817.41 rows=832 width=72) (actual time=31.112..633.795 rows=10 loops=1)

  • Join Filter: (cd.cd_uf = ud.cd_uf)
  • Rows Removed by Join Filter: 360
8. 0.037 633.701 ↑ 83.2 10 1

Nested Loop (cost=1.84..201,728.68 rows=832 width=73) (actual time=31.096..633.701 rows=10 loops=1)

9. 0.067 633.604 ↑ 83.2 10 1

Nested Loop (cost=1.56..201,397.02 rows=832 width=61) (actual time=31.081..633.604 rows=10 loops=1)

  • Join Filter: (co.cd_uf = uo.cd_uf)
  • Rows Removed by Join Filter: 360
10. 0.046 633.487 ↑ 83.2 10 1

Nested Loop (cost=1.56..200,308.29 rows=832 width=62) (actual time=31.053..633.487 rows=10 loops=1)

11. 0.028 633.321 ↑ 83.2 10 1

Nested Loop (cost=1.28..199,976.62 rows=832 width=50) (actual time=31.021..633.321 rows=10 loops=1)

12. 0.133 631.423 ↑ 83.2 10 1

Nested Loop (cost=0.86..199,963.58 rows=832 width=54) (actual time=29.160..631.423 rows=10 loops=1)

13. 630.990 630.990 ↑ 88.1 10 1

Index Scan Backward using idx_ctrc_dt_emissao on ctrc c (cost=0.43..197,692.73 rows=881 width=46) (actual time=29.128..630.990 rows=10 loops=1)

  • Filter: (cd_pessoa_motorista = 63696)
  • Rows Removed by Filter: 244110
14. 0.300 0.300 ↑ 1.0 1 10

Index Scan using pk_carta_frete on carta_frete cf (cost=0.43..2.58 rows=1 width=8) (actual time=0.030..0.030 rows=1 loops=10)

  • Index Cond: (cd_ctrc = c.cd_ctrc)
15. 0.015 1.870 ↑ 1.0 1 10

Materialize (cost=0.42..2.64 rows=1 width=4) (actual time=0.187..0.187 rows=1 loops=10)

16. 1.855 1.855 ↑ 1.0 1 1

Index Only Scan using pk_motorista on motorista m (cost=0.42..2.64 rows=1 width=4) (actual time=1.853..1.855 rows=1 loops=1)

  • Index Cond: (cd_pessoa = 63696)
  • Heap Fetches: 1
17. 0.120 0.120 ↑ 1.0 1 10

Index Scan using pk_cidade on cidade co (cost=0.28..0.40 rows=1 width=20) (actual time=0.012..0.012 rows=1 loops=10)

  • Index Cond: (cd_cidade = c.cd_cidade_origem)
18. 0.034 0.050 ↑ 2.4 37 10

Materialize (cost=0.00..2.32 rows=88 width=7) (actual time=0.002..0.005 rows=37 loops=10)

19. 0.016 0.016 ↑ 2.4 37 1

Seq Scan on uf uo (cost=0.00..1.88 rows=88 width=7) (actual time=0.012..0.016 rows=37 loops=1)

20. 0.060 0.060 ↑ 1.0 1 10

Index Scan using pk_cidade on cidade cd (cost=0.28..0.40 rows=1 width=20) (actual time=0.006..0.006 rows=1 loops=10)

  • Index Cond: (cd_cidade = c.cd_cidade_destino)
21. 0.033 0.040 ↑ 2.4 37 10

Materialize (cost=0.00..2.32 rows=88 width=7) (actual time=0.001..0.004 rows=37 loops=10)

22. 0.007 0.007 ↑ 2.4 37 1

Seq Scan on uf ud (cost=0.00..1.88 rows=88 width=7) (actual time=0.003..0.007 rows=37 loops=1)

23. 0.130 0.130 ↑ 1.0 1 10

Index Scan using pk_pessoa on pessoa f (cost=0.42..2.19 rows=1 width=39) (actual time=0.013..0.013 rows=1 loops=10)

  • Index Cond: (cd_pessoa = c.cd_pessoa_filial)
24. 2.440 2.440 ↑ 2.0 1 10

Index Only Scan using pk_carta_frete_parcelamento on carta_frete_parcelamento cfp (cost=0.43..0.50 rows=2 width=4) (actual time=0.244..0.244 rows=1 loops=10)

  • Index Cond: (cd_ctrc = cf.cd_ctrc)
  • Filter: (id_tipo = ANY ('{0,1}'::integer[]))
  • Heap Fetches: 10
25. 0.158 0.200 ↑ 1.2 156 10

Materialize (cost=0.00..7.77 rows=185 width=17) (actual time=0.002..0.020 rows=156 loops=10)

26. 0.042 0.042 ↑ 1.2 156 1

Seq Scan on agencia a (cost=0.00..6.85 rows=185 width=17) (actual time=0.008..0.042 rows=156 loops=1)

27. 0.012 0.020 ↑ 1.2 8 10

Materialize (cost=0.00..1.15 rows=10 width=15) (actual time=0.001..0.002 rows=8 loops=10)

28. 0.008 0.008 ↑ 1.0 10 1

Seq Scan on administradora_pagamento_eletronico ape (cost=0.00..1.10 rows=10 width=15) (actual time=0.007..0.008 rows=10 loops=1)

29.          

SubPlan (forWindowAgg)

30. 0.070 8.690 ↑ 1.0 1 10

Limit (cost=7.99..8.00 rows=1 width=6) (actual time=0.866..0.869 rows=1 loops=10)

31. 0.180 8.620 ↑ 1.0 1 10

Sort (cost=7.99..8.00 rows=1 width=6) (actual time=0.862..0.862 rows=1 loops=10)

  • Sort Key: cfpag_.nr_parcela DESC
  • Sort Method: quicksort Memory: 25kB
32. 0.060 8.440 ↑ 1.0 1 10

Nested Loop Left Join (cost=1.29..7.98 rows=1 width=6) (actual time=0.840..0.844 rows=1 loops=10)

  • Join Filter: ((cfpag_.cd_ctrc = cfp_.cd_ctrc) AND (cfpag_.id_tipo = cfp_.id_tipo) AND (cfpag_.nr_parcela = cfp_.nr_parcela))
33. 0.050 1.000 ↑ 1.0 1 10

Nested Loop (cost=0.86..5.31 rows=1 width=16) (actual time=0.097..0.100 rows=1 loops=10)

34. 0.880 0.880 ↑ 1.0 1 10

Index Scan using pk_carta_frete_parcelamento on carta_frete_parcelamento cfp_ (cost=0.43..2.65 rows=1 width=12) (actual time=0.087..0.088 rows=1 loops=10)

  • Index Cond: ((cd_ctrc = cf.cd_ctrc) AND (id_tipo = 1))
  • Filter: (dt_cancelamento IS NULL)
35. 0.070 0.070 ↑ 1.0 1 10

Index Scan using pk_carta_frete on carta_frete cf_ (cost=0.43..2.65 rows=1 width=8) (actual time=0.005..0.007 rows=1 loops=10)

  • Index Cond: (cd_ctrc = cf.cd_ctrc)
36. 7.380 7.380 ↑ 1.0 1 10

Index Only Scan using pk_carta_frete_pagamento on carta_frete_pagamento cfpag_ (cost=0.43..2.65 rows=1 width=8) (actual time=0.738..0.738 rows=1 loops=10)

  • Index Cond: ((cd_ctrc = cf.cd_ctrc) AND (id_tipo = 1))
  • Heap Fetches: 9
Planning time : 13.028 ms
Execution time : 646.263 ms