explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KIqH

Settings
# exclusive inclusive rows x rows loops node
1. 0.014 464.498 ↑ 1.0 10 1

Limit (cost=2.70..3,435.31 rows=10 width=197) (actual time=2.518..464.498 rows=10 loops=1)

2. 0.218 464.484 ↑ 61.6 10 1

WindowAgg (cost=2.70..211,451.53 rows=616 width=197) (actual time=2.517..464.484 rows=10 loops=1)

3. 0.036 463.656 ↑ 61.6 10 1

Nested Loop Left Join (cost=2.70..206,491.19 rows=616 width=119) (actual time=2.415..463.656 rows=10 loops=1)

  • Join Filter: (ape.cd_pessoa = cf.cd_pessoa_adm_pgto_eletronico)
  • Rows Removed by Join Filter: 73
4. 0.182 463.600 ↑ 61.6 10 1

Nested Loop Left Join (cost=2.70..206,399.88 rows=616 width=112) (actual time=2.398..463.600 rows=10 loops=1)

  • Join Filter: (c.cd_agencia = a.cd_agencia)
  • Rows Removed by Join Filter: 1550
5. 0.046 463.238 ↑ 61.6 10 1

Nested Loop Semi Join (cost=2.70..204,691.40 rows=616 width=103) (actual time=2.306..463.238 rows=10 loops=1)

  • Join Filter: (c.cd_ctrc = cfp.cd_ctrc)
6. 0.050 463.022 ↑ 79.2 10 1

Nested Loop (cost=2.27..204,297.61 rows=792 width=103) (actual time=2.275..463.022 rows=10 loops=1)

7. 0.054 462.842 ↑ 79.2 10 1

Nested Loop (cost=1.84..202,548.36 rows=792 width=72) (actual time=2.255..462.842 rows=10 loops=1)

  • Join Filter: (cd.cd_uf = ud.cd_uf)
  • Rows Removed by Join Filter: 360
8. 0.034 462.738 ↑ 79.2 10 1

Nested Loop (cost=1.84..201,512.43 rows=792 width=73) (actual time=2.234..462.738 rows=10 loops=1)

9. 0.057 462.644 ↑ 79.2 10 1

Nested Loop (cost=1.56..201,192.80 rows=792 width=61) (actual time=2.221..462.644 rows=10 loops=1)

  • Join Filter: (co.cd_uf = uo.cd_uf)
  • Rows Removed by Join Filter: 360
10. 0.049 462.527 ↑ 79.2 10 1

Nested Loop (cost=1.56..200,156.87 rows=792 width=62) (actual time=2.192..462.527 rows=10 loops=1)

11. 0.030 462.368 ↑ 79.2 10 1

Nested Loop (cost=1.28..199,837.24 rows=792 width=50) (actual time=2.166..462.368 rows=10 loops=1)

12. 0.102 462.298 ↑ 79.2 10 1

Nested Loop (cost=0.86..199,824.70 rows=792 width=54) (actual time=2.132..462.298 rows=10 loops=1)

13. 462.006 462.006 ↑ 83.9 10 1

Index Scan Backward using idx_ctrc_dt_emissao on ctrc c (cost=0.43..197,659.55 rows=839 width=46) (actual time=2.080..462.006 rows=10 loops=1)

  • Filter: ((dt_cancelamento IS NULL) AND (cd_pessoa_motorista = 63696))
  • Rows Removed by Filter: 244066
14. 0.190 0.190 ↑ 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.019..0.019 rows=1 loops=10)

  • Index Cond: (cd_ctrc = c.cd_ctrc)
15. 0.014 0.040 ↑ 1.0 1 10

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

16. 0.026 0.026 ↑ 1.0 1 1

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

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

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

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

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

19. 0.015 0.015 ↑ 2.4 37 1

Seq Scan on uf uo (cost=0.00..1.88 rows=88 width=7) (actual time=0.011..0.015 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.043 0.050 ↑ 2.4 37 10

Materialize (cost=0.00..2.32 rows=88 width=7) (actual time=0.001..0.005 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.21 rows=1 width=39) (actual time=0.013..0.013 rows=1 loops=10)

  • Index Cond: (cd_pessoa = c.cd_pessoa_filial)
24. 0.170 0.170 ↑ 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.017..0.017 rows=1 loops=10)

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

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

26. 0.044 0.044 ↑ 1.2 156 1

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

27. 0.013 0.020 ↑ 1.2 8 10

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

28. 0.007 0.007 ↑ 1.0 10 1

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

29.          

SubPlan (forWindowAgg)

30. 0.060 0.610 ↑ 1.0 1 10

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

31. 0.170 0.550 ↑ 1.0 1 10

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

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

Nested Loop Left Join (cost=1.29..7.98 rows=1 width=6) (actual time=0.037..0.038 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 0.180 ↑ 1.0 1 10

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

34. 0.090 0.090 ↑ 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.009..0.009 rows=1 loops=10)

  • Index Cond: ((cd_ctrc = cf.cd_ctrc) AND (id_tipo = 1))
  • Filter: (dt_cancelamento IS NULL)
35. 0.040 0.040 ↑ 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.004..0.004 rows=1 loops=10)

  • Index Cond: (cd_ctrc = cf.cd_ctrc)
36. 0.150 0.150 ↑ 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.015..0.015 rows=1 loops=10)

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