explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qwi6

Settings
# exclusive inclusive rows x rows loops node
1. 0.150 1,224.524 ↑ 13.0 6 1

GroupAggregate (cost=1,356.85..823,336.35 rows=78 width=277) (actual time=1,100.202..1,224.524 rows=6 loops=1)

  • Group Key: det.bico_fk, b.numero_bic, tp.descricao_tipcomb
  • Functions: 84
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 9.115 ms, Inlining 49.492 ms, Optimization 631.998 ms, Emission 393.691 ms, Total 1084.295 ms
2. 0.140 1,078.496 ↓ 2.1 163 1

Sort (cost=1,356.85..1,357.04 rows=78 width=49) (actual time=1,078.473..1,078.496 rows=163 loops=1)

  • Sort Key: det.bico_fk, b.numero_bic, tp.descricao_tipcomb
  • Sort Method: quicksort Memory: 47kB
3. 0.101 1,078.356 ↓ 2.1 163 1

Nested Loop (cost=1.13..1,354.39 rows=78 width=49) (actual time=1,076.487..1,078.356 rows=163 loops=1)

  • Join Filter: (t.tipocombustivel_fk = tp.id_tipocombustivel)
  • Rows Removed by Join Filter: 386
4. 0.125 1,078.255 ↓ 2.1 163 1

Nested Loop (cost=1.13..1,349.38 rows=78 width=40) (actual time=1,076.469..1,078.255 rows=163 loops=1)

  • Join Filter: (b.tanque_fk = t.id_tanque)
  • Rows Removed by Join Filter: 430
5. 0.145 1,078.130 ↓ 2.1 163 1

Nested Loop (cost=1.13..1,338.36 rows=78 width=40) (actual time=1,076.427..1,078.130 rows=163 loops=1)

  • Join Filter: (det.bico_fk = b.id_bico)
  • Rows Removed by Join Filter: 542
6. 0.058 1,077.985 ↓ 2.1 163 1

Nested Loop (cost=1.13..1,331.09 rows=78 width=36) (actual time=1,076.395..1,077.985 rows=163 loops=1)

7. 0.038 1,077.275 ↑ 1.3 163 1

Nested Loop (cost=0.71..1,213.02 rows=215 width=14) (actual time=1,076.363..1,077.275 rows=163 loops=1)

8. 1,076.553 1,076.553 ↑ 1.4 57 1

Index Scan using fk_movimento_cupomcab on ecf_cupomcab cab (cost=0.29..150.46 rows=77 width=4) (actual time=1,076.303..1,076.553 rows=57 loops=1)

  • Index Cond: ((movimento_fk = 782) AND (loja_fk = 1))
  • Filter: ((status_cupom)::text = ANY ('{F,O,D}'::text[]))
9. 0.684 0.684 ↑ 1.0 3 57

Index Scan using fk_cupomcab_cupomdetbico on ecf_cupomdet_bico det (cost=0.42..13.77 rows=3 width=18) (actual time=0.007..0.012 rows=3 loops=57)

  • Index Cond: ((cupomcab_fk = cab.id_cupomcab) AND (loja_fk = 1))
  • Filter: ((status_cupdetbic)::text = 'F'::text)
10. 0.652 0.652 ↑ 1.0 1 163

Index Scan using vd_abastecimentos_pkey on vd_abastecimentos ab (cost=0.42..0.54 rows=1 width=30) (actual time=0.004..0.004 rows=1 loops=163)

  • Index Cond: ((id_abastecimentos = det.abastecimento_fk) AND (loja_fk = 1))
  • Filter: (det.bico_fk = bico_fk)
11. 0.000 0.000 ↑ 1.5 4 163

Materialize (cost=0.00..1.10 rows=6 width=12) (actual time=0.000..0.000 rows=4 loops=163)

12. 0.026 0.026 ↑ 1.0 6 1

Seq Scan on cd_bico b (cost=0.00..1.07 rows=6 width=12) (actual time=0.025..0.026 rows=6 loops=1)

  • Filter: (loja_fk = 1)
13. 0.000 0.000 ↑ 1.0 4 163

Materialize (cost=0.00..7.07 rows=4 width=8) (actual time=0.000..0.000 rows=4 loops=163)

14. 0.037 0.037 ↑ 1.0 4 1

Seq Scan on cd_tanque t (cost=0.00..7.05 rows=4 width=8) (actual time=0.034..0.037 rows=4 loops=1)

  • Filter: (loja_fk = 1)
15. 0.000 0.000 ↑ 1.3 3 163

Materialize (cost=0.00..1.06 rows=4 width=17) (actual time=0.000..0.000 rows=3 loops=163)

16. 0.011 0.011 ↑ 1.0 4 1

Seq Scan on cd_tipocombustivel tp (cost=0.00..1.04 rows=4 width=17) (actual time=0.010..0.011 rows=4 loops=1)

17.          

SubPlan (for GroupAggregate)

18. 0.060 91.662 ↑ 1.0 1 6

Aggregate (cost=5,310.03..5,310.04 rows=1 width=32) (actual time=15.277..15.277 rows=1 loops=6)

19. 13.545 91.602 ↑ 1.4 27 6

Hash Semi Join (cost=734.29..5,309.94 rows=37 width=6) (actual time=15.066..15.267 rows=27 loops=6)

  • Hash Cond: (vd_abastecimentos.coo = ecf_cupomcab.coo_cupom)
20. 67.902 78.012 ↓ 1.0 30,788 6

Bitmap Heap Scan on vd_abastecimentos (cost=583.14..5,077.21 rows=30,779 width=10) (actual time=2.104..13.002 rows=30,788 loops=6)

  • Recheck Cond: (bico_fk = det.bico_fk)
  • Filter: ((loja_fk = 1) AND ((status_abastecimento)::text = 'F'::text))
  • Rows Removed by Filter: 22
  • Heap Blocks: exact=20,711
21. 10.110 10.110 ↓ 1.0 30,816 6

Bitmap Index Scan on fk_bico_abastecimentos (cost=0.00..575.45 rows=30,804 width=0) (actual time=1.685..1.685 rows=30,816 loops=6)

  • Index Cond: (bico_fk = det.bico_fk)
22. 0.010 0.045 ↑ 1.4 57 1

Hash (cost=150.17..150.17 rows=78 width=4) (actual time=0.044..0.045 rows=57 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
23. 0.035 0.035 ↑ 1.4 57 1

Index Scan using fk_movimento_cupomcab on ecf_cupomcab (cost=0.29..150.17 rows=78 width=4) (actual time=0.011..0.035 rows=57 loops=1)

  • Index Cond: ((movimento_fk = 782) AND (loja_fk = 1))
24. 0.012 54.216 ↑ 1.0 1 6

Aggregate (cost=5,228.08..5,228.09 rows=1 width=32) (actual time=9.036..9.036 rows=1 loops=6)

25. 0.138 54.204 ↓ 0.0 0 6

Nested Loop Semi Join (cost=575.74..5,228.08 rows=1 width=6) (actual time=9.033..9.034 rows=0 loops=6)

  • Join Filter: (vd_abastecimentos_1.coo = ecf_cupomcab_1.coo_cupom)
  • Rows Removed by Join Filter: 314
26. 44.730 53.934 ↑ 1.2 6 6

Bitmap Heap Scan on vd_abastecimentos vd_abastecimentos_1 (cost=575.45..5,069.52 rows=7 width=10) (actual time=3.003..8.989 rows=6 loops=6)

  • Recheck Cond: (bico_fk = det.bico_fk)
  • Filter: ((loja_fk = 1) AND ((status_abastecimento)::text = 'A'::text))
  • Rows Removed by Filter: 30,805
  • Heap Blocks: exact=20,711
27. 9.204 9.204 ↓ 1.0 30,816 6

Bitmap Index Scan on fk_bico_abastecimentos (cost=0.00..575.45 rows=30,804 width=0) (actual time=1.534..1.534 rows=30,816 loops=6)

  • Index Cond: (bico_fk = det.bico_fk)
28. 0.079 0.132 ↑ 1.4 57 33

Materialize (cost=0.29..150.56 rows=78 width=4) (actual time=0.001..0.004 rows=57 loops=33)

29. 0.053 0.053 ↑ 1.4 57 1

Index Scan using fk_movimento_cupomcab on ecf_cupomcab ecf_cupomcab_1 (cost=0.29..150.17 rows=78 width=4) (actual time=0.017..0.053 rows=57 loops=1)

  • Index Cond: ((movimento_fk = 782) AND (loja_fk = 1))
Planning time : 6.020 ms
Execution time : 1,268.111 ms