explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RIZS

Settings
# exclusive inclusive rows x rows loops node
1. 0.530 25.427 ↓ 6.6 1,281 1

HashAggregate (cost=4,179.06..4,180.99 rows=193 width=48) (actual time=25.232..25.427 rows=1,281 loops=1)

  • Group Key: grupocompraitemfiltrado.unidadenegocioid, grupocompraitemfiltrado.produtoid
2.          

CTE grupocompraitem

3. 1.000 23.502 ↓ 1.3 1,290 1

HashAggregate (cost=4,105.38..4,115.15 rows=977 width=43) (actual time=23.314..23.502 rows=1,290 loops=1)

  • Group Key: grupocompra.id, unidadenegocioparticipantegrupocompra.unidadenegocioid, produto.id, grupocompra.intervalocompra, grupocompraitem.desconsiderar
4. 0.418 22.502 ↓ 2.3 2,212 1

Hash Join (cost=3,124.54..4,093.17 rows=977 width=43) (actual time=16.637..22.502 rows=2,212 loops=1)

  • Hash Cond: (grupocompraitem.grupocompraid = grupocompra.id)
5. 2.889 21.998 ↓ 1.8 1,340 1

Hash Right Join (cost=3,122.07..4,078.08 rows=760 width=17) (actual time=16.537..21.998 rows=1,340 loops=1)

  • Hash Cond: (produto.id = grupocompraitem.produtoid)
  • Join Filter: (grupocompraitem.tipo = 'D'::bpchar)
6. 2.603 2.603 ↑ 1.0 28,037 1

Seq Scan on produto (cost=0.00..841.37 rows=28,037 width=8) (actual time=0.018..2.603 rows=28,037 loops=1)

7. 0.200 16.506 ↓ 1.8 1,340 1

Hash (cost=3,112.57..3,112.57 rows=760 width=19) (actual time=16.506..16.506 rows=1,340 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 92kB
8. 2.155 16.306 ↓ 1.8 1,340 1

Merge Left Join (cost=2,968.58..3,112.57 rows=760 width=19) (actual time=11.815..16.306 rows=1,340 loops=1)

  • Merge Cond: (grupocompraitem.fabricanteid = produto2.fabricanteid)
  • Join Filter: (grupocompraitem.tipo = 'A'::bpchar)
  • Rows Removed by Join Filter: 577
9. 0.381 0.727 ↓ 1.0 777 1

Sort (cost=55.97..57.87 rows=760 width=27) (actual time=0.673..0.727 rows=777 loops=1)

  • Sort Key: grupocompraitem.fabricanteid
  • Sort Method: quicksort Memory: 85kB
10. 0.346 0.346 ↓ 1.0 777 1

Seq Scan on grupocompraitem (cost=0.00..19.60 rows=760 width=27) (actual time=0.013..0.346 rows=777 loops=1)

11. 7.759 13.424 ↓ 1.0 28,062 1

Sort (cost=2,912.61..2,982.70 rows=28,037 width=8) (actual time=10.924..13.424 rows=28,062 loops=1)

  • Sort Key: produto2.fabricanteid
  • Sort Method: quicksort Memory: 2083kB
12. 5.665 5.665 ↑ 1.0 28,037 1

Seq Scan on produto produto2 (cost=0.00..841.37 rows=28,037 width=8) (actual time=0.012..5.665 rows=28,037 loops=1)

13. 0.011 0.086 ↓ 1.7 15 1

Hash (cost=2.35..2.35 rows=9 width=42) (actual time=0.086..0.086 rows=15 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.032 0.075 ↓ 1.7 15 1

Hash Join (cost=1.16..2.35 rows=9 width=42) (actual time=0.049..0.075 rows=15 loops=1)

  • Hash Cond: (unidadenegocioparticipantegrupocompra.grupocompraid = grupocompra.id)
15. 0.020 0.020 ↓ 1.7 15 1

Seq Scan on unidadenegocioparticipantegrupocompra (cost=0.00..1.09 rows=9 width=16) (actual time=0.014..0.020 rows=15 loops=1)

16. 0.009 0.023 ↓ 1.6 11 1

Hash (cost=1.07..1.07 rows=7 width=26) (actual time=0.023..0.023 rows=11 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
17. 0.014 0.014 ↓ 1.6 11 1

Seq Scan on grupocompra (cost=0.00..1.07 rows=7 width=26) (actual time=0.008..0.014 rows=11 loops=1)

18.          

CTE grupocompraitemfiltrado

19. 0.459 24.661 ↓ 6.6 1,283 1

HashSetOp Except (cost=0.00..58.60 rows=193 width=46) (actual time=24.583..24.661 rows=1,283 loops=1)

20. 0.076 24.202 ↓ 1.3 1,290 1

Append (cost=0.00..48.84 rows=976 width=46) (actual time=23.317..24.202 rows=1,290 loops=1)

21. 0.132 24.032 ↓ 2.6 1,286 1

Subquery Scan on *SELECT* 1 (cost=0.00..24.42 rows=488 width=46) (actual time=23.317..24.032 rows=1,286 loops=1)

22. 23.900 23.900 ↓ 2.6 1,286 1

CTE Scan on grupocompraitem grupocompraitem_1 (cost=0.00..19.54 rows=488 width=42) (actual time=23.316..23.900 rows=1,286 loops=1)

  • Filter: (NOT desconsiderar)
  • Rows Removed by Filter: 4
23. 0.002 0.094 ↑ 122.0 4 1

Subquery Scan on *SELECT* 2 (cost=0.00..24.42 rows=488 width=46) (actual time=0.034..0.094 rows=4 loops=1)

24. 0.092 0.092 ↑ 122.0 4 1

CTE Scan on grupocompraitem grupocompraitem_2 (cost=0.00..19.54 rows=488 width=42) (actual time=0.032..0.092 rows=4 loops=1)

  • Filter: desconsiderar
  • Rows Removed by Filter: 1286
25. 24.897 24.897 ↓ 6.6 1,283 1

CTE Scan on grupocompraitemfiltrado (cost=0.00..3.86 rows=193 width=34) (actual time=24.590..24.897 rows=1,283 loops=1)