explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MJmD : Optimization for: plan #ef9Sr

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=18,441,493.59..19,022,407.94 rows=11,209,132 width=208) (actual rows= loops=)

  • Hash Cond: (dados_cgra.codmod = modelos_validos.codmod)
2.          

CTE modelos_validos

3. 0.000 0.000 ↓ 0.0

Seq Scan on modc (cost=0.00..18.74 rows=263 width=154) (actual rows= loops=)

  • Filter: (((tpamod)::text <> ALL ('{S,T}'::text[])) AND ((atrmod)::text !~ '^(?:.*(?:TL|1|2|3).*)$'::text))
4.          

CTE dados_cgra

5. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=16,182,591.63..18,441,466.30 rows=8,524,055 width=58) (actual rows= loops=)

  • Group Key: cgra.agecgr, cgra.codmod, cgra.anoced, cgra.nroced, cgra.datvct
  • Filter: (sum(cgra.vlrcgr) > '0'::numeric)
6. 0.000 0.000 ↓ 0.0

Sort (cost=16,182,591.63..16,395,693.01 rows=85,240,554 width=42) (actual rows= loops=)

  • Sort Key: cgra.agecgr, cgra.codmod, cgra.anoced, cgra.nroced, cgra.datvct
7. 0.000 0.000 ↓ 0.0

Seq Scan on cgra (cost=0.00..2,332,116.54 rows=85,240,554 width=42) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

CTE Scan on dados_cgra (cost=0.00..170,481.10 rows=8,524,055 width=58) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Hash (cost=5.26..5.26 rows=263 width=154) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

CTE Scan on modelos_validos (cost=0.00..5.26 rows=263 width=154) (actual rows= loops=)