explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xfGW

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

CTE Scan on pedidos (cost=38,702,122.58..38,702,122.60 rows=1 width=390) (actual rows= loops=)

2.          

CTE naorecebidos

3. 0.000 0.000 ↓ 0.0

Unique (cost=406.19..406.19 rows=1 width=8) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=406.19..406.19 rows=1 width=8) (actual rows= loops=)

  • Sort Key: ib.iditembase
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=253.38..406.18 rows=1 width=8) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on notatransferida nt (cost=252.81..300.58 rows=16 width=8) (actual rows= loops=)

  • Recheck Cond: (((idfilialorigem)::integer = 10,331) AND (datarecebimento IS NULL))
7. 0.000 0.000 ↓ 0.0

BitmapAnd (cost=252.81..252.81 rows=16 width=0) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_notatransferida_idregistronota (cost=0.00..118.72 rows=6,972 width=0) (actual rows= loops=)

  • Index Cond: ((idfilialorigem)::integer = 10,331)
9. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_notatransferida_datarecebimento (cost=0.00..133.83 rows=8,187 width=0) (actual rows= loops=)

  • Index Cond: (datarecebimento IS NULL)
10. 0.000 0.000 ↓ 0.0

Index Scan using ix_itembase_iditemregistronota on itembase ib (cost=0.57..6.59 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (((idfilial)::integer = 10,331) AND ((idregistronota)::integer = (nt.idregistronota)::integer))
  • Filter: (iditembase IS NOT NULL)
11.          

CTE pedidos

12. 0.000 0.000 ↓ 0.0

WindowAgg (cost=38,701,709.65..38,701,716.38 rows=1 width=292) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Sort (cost=38,701,709.65..38,701,709.66 rows=1 width=186) (actual rows= loops=)

  • Sort Key: i.idregistronota
14. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3,490,912.31..38,701,709.64 rows=1 width=186) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3,490,912.04..38,701,709.34 rows=1 width=184) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3,490,911.76..38,701,709.05 rows=1 width=178) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3,490,911.19..38,701,702.60 rows=1 width=176) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Hash Semi Join (cost=3,490,910.90..38,701,624.63 rows=1 width=172) (actual rows= loops=)

  • Hash Cond: (((i.idfilial)::integer = (naorecebidos.idfilialorigem)::integer) AND ((i.iditembase)::integer = (naorecebidos.iditembase)::integer))
19. 0.000 0.000 ↓ 0.0

Gather (cost=3,490,910.87..37,639,461.58 rows=202,316,765 width=172) (actual rows= loops=)

  • Workers Planned: 4
20. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=3,489,910.87..17,406,785.08 rows=50,579,191 width=172) (actual rows= loops=)

  • Hash Cond: (rc.idfilial = (f.idfilial)::integer)
21. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=3,489,878.00..17,272,553.68 rows=50,579,191 width=170) (actual rows= loops=)

  • Hash Cond: (((i.idfilial)::integer = rc.idfilialdeposito) AND ((i.iditembase)::integer = rc.iditembasedeposito))
22. 0.000 0.000 ↓ 0.0

Parallel Hash Left Join (cost=3,487,643.88..16,890,678.89 rows=50,579,191 width=154) (actual rows= loops=)

  • Hash Cond: (((i.idfilial)::integer = r.idfilial) AND (i.idmapacarga = r.idmapacarga))
23. 0.000 0.000 ↓ 0.0

Parallel Hash Left Join (cost=3,476,758.90..15,740,806.00 rows=50,579,191 width=150) (actual rows= loops=)

  • Hash Cond: ((i.idcnpj_cpf)::bigint = (pe.idcnpj_cpf)::bigint)
24. 0.000 0.000 ↓ 0.0

Parallel Hash Left Join (cost=3,264,501.50..15,395,778.15 rows=50,579,191 width=114) (actual rows= loops=)

  • Hash Cond: ((i.idproduto)::integer = (p.idproduto)::integer)
25. 0.000 0.000 ↓ 0.0

Parallel Hash Left Join (cost=3,257,171.81..15,255,675.01 rows=50,579,191 width=69) (actual rows= loops=)

  • Hash Cond: (((n.idfilial)::integer = (nt_1.idfilialorigem)::integer) AND ((n.idregistronota)::integer = (nt_1.idregistronota)::integer))
26. 0.000 0.000 ↓ 0.0

Parallel Hash Left Join (cost=3,148,087.99..14,881,050.42 rows=50,579,191 width=69) (actual rows= loops=)

  • Hash Cond: (((i.idfilial)::integer = (n.idfilial)::integer) AND ((i.idregistronota)::integer = (n.idregistronota)::integer))
27. 0.000 0.000 ↓ 0.0

Parallel Hash Left Join (cost=1,794,373.10..12,118,507.77 rows=50,579,191 width=61) (actual rows= loops=)

  • Hash Cond: (((i.idpedidovenda)::integer = (pv.idpedidovenda)::integer) AND ((i.idfilial)::integer = (pv.idfilial)::integer))
28. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on itembase i (cost=0.00..8,992,968.91 rows=50,579,191 width=51) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=1,517,588.44..1,517,588.44 rows=13,269,044 width=18) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on pedidovenda pv (cost=0.00..1,517,588.44 rows=13,269,044 width=18) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=1,079,662.75..1,079,662.75 rows=14,495,276 width=8) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Parallel Index Only Scan using pk_nota on nota n (cost=0.56..1,079,662.75 rows=14,495,276 width=8) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=95,945.13..95,945.13 rows=875,913 width=12) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on notatransferida nt_1 (cost=0.00..95,945.13 rows=875,913 width=12) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=6,382.08..6,382.08 rows=75,808 width=49) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on produto p (cost=0.00..6,382.08 rows=75,808 width=49) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=192,071.07..192,071.07 rows=1,614,907 width=44) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on pessoa pe (cost=0.00..192,071.07 rows=1,614,907 width=44) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=6,588.99..6,588.99 rows=286,399 width=12) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on frete_mapa_carga_roteirizador_mapacarga r (cost=0.00..6,588.99 rows=286,399 width=12) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Hash (cost=1,419.25..1,419.25 rows=54,325 width=16) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Seq Scan on rastreio_venda_cd rc (cost=0.00..1,419.25 rows=54,325 width=16) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Hash (cost=27.94..27.94 rows=394 width=10) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Seq Scan on filial f (cost=0.00..27.94 rows=394 width=10) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Hash (cost=0.02..0.02 rows=1 width=8) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

CTE Scan on naorecebidos (cost=0.00..0.02 rows=1 width=8) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Index Scan using idx_rastreio_venda_cd_filialdeposito_pedidovendadeposito on rastreio_venda_cd rco (cost=0.29..77.95 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (idfilialdeposito = rc.idfilialdeposito)
  • Filter: (iditembasedeposito = rc.iditembasedeposito)
48. 0.000 0.000 ↓ 0.0

Index Scan using pk_itembase on itembase ibf (cost=0.57..6.46 rows=1 width=10) (actual rows= loops=)

  • Index Cond: (((idfilial)::integer = rco.idfilial) AND ((iditembase)::integer = rco.iditembase))
49. 0.000 0.000 ↓ 0.0

Index Scan using pk_filial on filial fl (cost=0.27..0.29 rows=1 width=10) (actual rows= loops=)

  • Index Cond: ((idfilial)::integer = (i.idfilial)::integer)
50. 0.000 0.000 ↓ 0.0

Index Scan using ix_fk_filial_pessoa on filial fld (cost=0.27..0.29 rows=1 width=18) (actual rows= loops=)

  • Index Cond: ((idcnpj_cpf)::bigint = (i.idcnpj_cpf)::bigint)
51.          

SubPlan (for WindowAgg)

52. 0.000 0.000 ↓ 0.0

Aggregate (cost=6.59..6.60 rows=1 width=8) (actual rows= loops=)

  • -> Index Only Scan using ix_itembase_iditempedidovenda on itembase ib_1 (cost=0.57..6.59 rows=1 width=0)" Index Cond: ((idfilial = rco.idfilial) AND (idpedidovenda = rco.idpedidovenda))