explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NcWd

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.002 194,579.659 ↓ 0.0 0 1

GroupAggregate (cost=3,756,039.29..12,643,010.05 rows=56,434 width=127) (actual time=194,579.659..194,579.659 rows=0 loops=1)

  • Group Key: a.idproduto, b.dataentsai
  • Buffers: shared hit=25737 read=422751
2. 0.039 194,579.657 ↓ 0.0 0 1

Sort (cost=3,756,039.29..3,756,180.37 rows=56,434 width=150) (actual time=194,579.657..194,579.657 rows=0 loops=1)

  • Sort Key: a.idproduto, b.dataentsai
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=25737 read=422751
3. 0.002 194,579.618 ↓ 0.0 0 1

Hash Join (cost=72,374.43..3,751,585.44 rows=56,434 width=150) (actual time=194,579.618..194,579.618 rows=0 loops=1)

  • Hash Cond: ((a.idnfmaster)::text = (b.idnfmaster)::text)
  • Buffers: shared hit=25731 read=422751
4. 160,177.224 194,579.616 ↓ 0.0 0 1

Seq Scan on nfdet a (cost=0.00..3,669,634.43 rows=57,362 width=121) (actual time=194,579.616..194,579.616 rows=0 loops=1)

  • Filter: (((cancelado = 0) OR (cancelado = '-1'::integer)) AND ((SubPlan 6) = 90))
  • Rows Removed by Filter: 11607843
  • Buffers: shared hit=25731 read=422751
5.          

SubPlan (forSeq Scan)

6. 34,402.392 34,402.392 ↑ 1.0 1 11,467,464

Result (cost=0.00..0.26 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=11,467,464)

  • Buffers: shared hit=24
7. 0.000 0.000 ↓ 0.0 0

Hash (cost=55,739.68..55,739.68 rows=747,100 width=50) (never executed)

8. 0.000 0.000 ↓ 0.0 0

Seq Scan on nfmaster b (cost=0.00..55,739.68 rows=747,100 width=50) (never executed)

  • Filter: (((situacao = 0) OR (situacao = '-1'::integer)) AND (dataentsai < CURRENT_DATE))
9.          

SubPlan (forGroupAggregate)

10. 0.000 0.000 ↓ 0.0 0

Function Scan on proc_calcimposto (cost=142.41..157.41 rows=1,000 width=8) (never executed)

11.          

Initplan (forFunction Scan)

12. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=61.83..61.84 rows=1 width=32) (never executed)

13. 0.000 0.000 ↓ 0.0 0

Index Scan using nfdet_idnfmaster_indx on nfdet (cost=0.56..59.51 rows=185 width=20) (never executed)

  • Index Cond: ((idnfmaster)::text = (b.idnfmaster)::text)
  • Filter: (cancelado = 0)
14. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=60.44..60.45 rows=1 width=32) (never executed)

15. 0.000 0.000 ↓ 0.0 0

Index Scan using nfdet_idnfmaster_indx on nfdet nfdet_1 (cost=0.56..59.51 rows=185 width=8) (never executed)

  • Index Cond: ((idnfmaster)::text = (b.idnfmaster)::text)
  • Filter: (cancelado = 0)
16. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.84..9.93 rows=1 width=12) (never executed)

17. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.84..9.93 rows=1 width=12) (never executed)

18. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.71..9.77 rows=1 width=3) (never executed)

19. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..9.47 rows=1 width=8) (never executed)

20. 0.000 0.000 ↓ 0.0 0

Seq Scan on fornecedores f (cost=0.00..1.02 rows=1 width=68) (never executed)

  • Filter: ((b.idclifor)::text = (idfornecedor)::text)
21. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_ceps on ceps cep (cost=0.42..8.44 rows=1 width=17) (never executed)

  • Index Cond: ((idcep)::text = (f.idcep)::text)
22. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_cidades on cidades cid (cost=0.28..0.30 rows=1 width=11) (never executed)

  • Index Cond: ((idcidade)::text = (cep.idcidade)::text)
23. 0.000 0.000 ↓ 0.0 0

Index Scan using unq1_ufs on ufs uf (cost=0.14..0.16 rows=1 width=24) (never executed)

  • Index Cond: ((iduf)::text = (cid.iduf)::text)
24. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.84..9.91 rows=1 width=12) (never executed)

25. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.84..9.91 rows=1 width=12) (never executed)

26. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.71..9.75 rows=1 width=3) (never executed)

27. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..9.45 rows=1 width=8) (never executed)

28. 0.000 0.000 ↓ 0.0 0

Seq Scan on usuarios u (cost=0.00..1.01 rows=1 width=68) (never executed)

29. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_ceps on ceps cep_1 (cost=0.42..8.44 rows=1 width=17) (never executed)

  • Index Cond: ((idcep)::text = (u.idcep)::text)
30. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_cidades on cidades cid_1 (cost=0.28..0.30 rows=1 width=11) (never executed)

  • Index Cond: ((idcidade)::text = (cep_1.idcidade)::text)
31. 0.000 0.000 ↓ 0.0 0

Index Scan using unq1_ufs on ufs uf_1 (cost=0.14..0.16 rows=1 width=24) (never executed)

  • Index Cond: ((iduf)::text = (cid_1.iduf)::text)