explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ADVh : Optimization for: Optimization for: plan #yjMh; plan #wnJx

Settings

Optimization path:

Optimization(s) for this plan:

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

Merge Join (cost=4,505,239.66..5,390,285.65 rows=47,649,078 width=262) (actual rows= loops=)

  • Merge Cond: ((s1.num_cnpj)::text = (s2.num_cnpj)::text)
  • Join Filter: ((s2.num_cnpj_empresa)::text <> (s1.num_cnpj_empresa)::text)
2. 0.000 0.000 ↓ 0.0

Sort (cost=2,252,619.83..2,269,681.53 rows=6,824,682 width=146) (actual rows= loops=)

  • Sort Key: s1.num_cnpj
3. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=246,315.12..964,751.40 rows=6,824,682 width=146) (actual rows= loops=)

  • Hash Cond: ((s1.cod_qualificacao_socio)::text = (qs1.cod)::text)
4. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=246,312.41..870,909.31 rows=6,824,682 width=123) (actual rows= loops=)

  • Hash Cond: ((s1.num_cnpj_empresa)::text = (pj1.num_cnpj)::text)
5. 0.000 0.000 ↓ 0.0

Seq Scan on vw_socio s1 (cost=0.00..321,012.82 rows=6,824,682 width=69) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Hash (cost=171,690.96..171,690.96 rows=3,351,396 width=54) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Seq Scan on vw_cnpj pj1 (cost=0.00..171,690.96 rows=3,351,396 width=54) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash (cost=1.76..1.76 rows=76 width=27) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Seq Scan on qualificacao_socio_resp_repres qs1 (cost=0.00..1.76 rows=76 width=27) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Materialize (cost=2,252,619.83..2,286,743.24 rows=6,824,682 width=146) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Sort (cost=2,252,619.83..2,269,681.53 rows=6,824,682 width=146) (actual rows= loops=)

  • Sort Key: s2.num_cnpj
12. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=246,315.12..964,751.40 rows=6,824,682 width=146) (actual rows= loops=)

  • Hash Cond: ((s2.cod_qualificacao_socio)::text = (qs2.cod)::text)
13. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=246,312.41..870,909.31 rows=6,824,682 width=123) (actual rows= loops=)

  • Hash Cond: ((s2.num_cnpj_empresa)::text = (pj2.num_cnpj)::text)
14. 0.000 0.000 ↓ 0.0

Seq Scan on vw_socio s2 (cost=0.00..321,012.82 rows=6,824,682 width=69) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Hash (cost=171,690.96..171,690.96 rows=3,351,396 width=54) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Seq Scan on vw_cnpj pj2 (cost=0.00..171,690.96 rows=3,351,396 width=54) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Hash (cost=1.76..1.76 rows=76 width=27) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Seq Scan on qualificacao_socio_resp_repres qs2 (cost=0.00..1.76 rows=76 width=27) (actual rows= loops=)