explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PX2t

Settings
# exclusive inclusive rows x rows loops node
1. 0.091 37.724 ↑ 1.0 1 1

Aggregate (cost=8,011.50..8,012.01 rows=1 width=5) (actual time=37.724..37.724 rows=1 loops=1)

2.          

Initplan (for Aggregate)

3. 0.000 0.217 ↑ 1.0 1 1

Aggregate (cost=519.02..519.03 rows=1 width=5) (actual time=0.217..0.217 rows=1 loops=1)

4. 0.000 0.217 ↓ 0.0 0 1

Nested Loop (cost=29.51..518.77 rows=102 width=5) (actual time=0.217..0.217 rows=0 loops=1)

5. 0.009 0.217 ↓ 0.0 0 1

Nested Loop (cost=29.51..139.82 rows=102 width=9) (actual time=0.217..0.217 rows=0 loops=1)

6. 0.028 0.028 ↓ 9.0 9 1

Index Scan using idx7_o on "PEDVENDA" pv (cost=0.00..4.92 rows=1 width=12) (actual time=0.015..0.028 rows=9 loops=1)

  • Index Cond: (("DTDEVOL" >= '2020-09-01'::date) AND ("DTDEVOL" <= '2020-09-01'::date) AND (("AUTENTICA")::text = 'A'::text) AND (("LIBERADO")::text = 'D'::text))
  • Filter: (("DATEPED" >= '2014-01-01'::date) AND (("LIBERADO")::text = ANY ('{S,D}'::text[])) AND ("DATEPED" <= ('now'::text)::date))
7. 0.009 0.180 ↓ 0.0 0 9

Bitmap Heap Scan on "PEDV_ITEM" pvi (cost=29.51..134.12 rows=52 width=21) (actual time=0.020..0.020 rows=0 loops=9)

  • Recheck Cond: (("ID_FILIAL" = pv."ID_FILIAL") AND ("ID_PEDIDO" = pv."ID_PEDIDO") AND ("ID_PRODUTO" = ANY ('{8,9,32234,24259,7,1,6,5,3,4,26551,2}'::integer[])))
8. 0.171 0.171 ↓ 0.0 0 9

Bitmap Index Scan on idx5 (cost=0.00..29.50 rows=52 width=0) (actual time=0.019..0.019 rows=0 loops=9)

  • Index Cond: (("ID_FILIAL" = pv."ID_FILIAL") AND ("ID_PEDIDO" = pv."ID_PEDIDO") AND ("ID_PRODUTO" = ANY ('{8,9,32234,24259,7,1,6,5,3,4,26551,2}'::integer[])))
9. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_produto_produto on "PRODUTO" p (cost=0.00..3.70 rows=1 width=4) (never executed)

  • Index Cond: ("ID_PRODUTO" = pvi."ID_PRODUTO")
10. 0.102 27.975 ↑ 1.0 1 1

Aggregate (cost=6,973.10..6,973.62 rows=1 width=4) (actual time=27.975..27.975 rows=1 loops=1)

11.          

Initplan (for Aggregate)

12. 0.011 9.296 ↑ 1.0 1 1

Aggregate (cost=518.84..518.85 rows=1 width=4) (actual time=9.296..9.296 rows=1 loops=1)

13. 0.000 9.285 ↑ 1.4 73 1

Nested Loop (cost=29.51..518.59 rows=102 width=4) (actual time=0.433..9.285 rows=73 loops=1)

14. 0.097 9.146 ↑ 1.4 73 1

Nested Loop (cost=29.51..139.64 rows=102 width=8) (actual time=0.427..9.146 rows=73 loops=1)

15. 0.309 0.309 ↓ 437.0 437 1

Index Scan using idx5_seg on "PEDVENDA" pv (cost=0.00..4.74 rows=1 width=12) (actual time=0.081..0.309 rows=437 loops=1)

  • Index Cond: ((("LIBERADO")::text = 'S'::text) AND (("AUTENTICA")::text = 'A'::text) AND ("DATEPED" >= '2014-01-01'::date) AND ("DATEPED" <= ('now'::text)::date) AND ("DATEPED" >= '2020-09-01'::date) AND ("DATEPED" <= '20 (...)
  • Filter: (("LIBERADO")::text = ANY ('{S,D}'::text[]))
16. 0.437 8.740 ↓ 0.0 0 437

Bitmap Heap Scan on "PEDV_ITEM" pvi (cost=29.51..134.12 rows=52 width=16) (actual time=0.020..0.020 rows=0 loops=437)

  • Recheck Cond: (("ID_FILIAL" = pv."ID_FILIAL") AND ("ID_PEDIDO" = pv."ID_PEDIDO") AND ("ID_PRODUTO" = ANY ('{8,9,32234,24259,7,1,6,5,3,4,26551,2}'::integer[])))
17. 8.303 8.303 ↓ 0.0 0 437

Bitmap Index Scan on idx5 (cost=0.00..29.50 rows=52 width=0) (actual time=0.019..0.019 rows=0 loops=437)

  • Index Cond: (("ID_FILIAL" = pv."ID_FILIAL") AND ("ID_PEDIDO" = pv."ID_PEDIDO") AND ("ID_PRODUTO" = ANY ('{8,9,32234,24259,7,1,6,5,3,4,26551,2}'::integer[])))
18. 0.146 0.146 ↑ 1.0 1 73

Index Scan using idx_produto_produto on "PRODUTO" p (cost=0.00..3.70 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=73)

  • Index Cond: ("ID_PRODUTO" = pvi."ID_PRODUTO")
19. 0.000 18.577 ↓ 12.2 281 1

Nested Loop (cost=4,057.54..6,454.19 rows=23 width=4) (actual time=16.244..18.577 rows=281 loops=1)

20. 0.286 18.061 ↓ 12.2 281 1

Hash Join (cost=4,057.54..6,368.70 rows=23 width=12) (actual time=16.238..18.061 rows=281 loops=1)

  • Hash Cond: (pvi."ID_PRODUTO" = p."ID_PRODUTO")
21. 0.147 1.702 ↑ 3.0 782 1

Nested Loop (cost=5.00..2,307.25 rows=2,313 width=8) (actual time=0.128..1.702 rows=782 loops=1)

22. 0.111 0.223 ↓ 444.0 444 1

Bitmap Heap Scan on "PEDVENDA" pv (cost=5.00..7.03 rows=1 width=12) (actual time=0.119..0.223 rows=444 loops=1)

  • Recheck Cond: ((("LIBERADO")::text = ANY ('{S,D}'::text[])) AND (("AUTENTICA")::text = 'A'::text) AND ("DATEPED" >= '2014-01-01'::date) AND ("DATEPED" <= ('now'::text)::date) AND ("DATEPED" >= '2020-09-01'::date) AND ("DAT (...)
23. 0.112 0.112 ↓ 444.0 444 1

Bitmap Index Scan on idx5_seg (cost=0.00..5.00 rows=1 width=0) (actual time=0.112..0.112 rows=444 loops=1)

  • Index Cond: ((("LIBERADO")::text = ANY ('{S,D}'::text[])) AND (("AUTENTICA")::text = 'A'::text) AND ("DATEPED" >= '2014-01-01'::date) AND ("DATEPED" <= ('now'::text)::date) AND ("DATEPED" >= '2020-09-01'::date) AND ( (...)
24. 1.332 1.332 ↑ 594.0 2 444

Index Scan using idx_pvitem1 on "PEDV_ITEM" pvi (cost=0.00..2,282.40 rows=1,188 width=16) (actual time=0.002..0.003 rows=2 loops=444)

  • Index Cond: (("ID_FILIAL" = pv."ID_FILIAL") AND ("ID_PEDIDO" = pv."ID_PEDIDO"))
25. 1.235 16.073 ↓ 24.9 9,897 1

Hash (cost=4,047.59..4,047.59 rows=397 width=4) (actual time=16.073..16.073 rows=9,897 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 348kB
26. 14.838 14.838 ↓ 24.9 9,897 1

Seq Scan on "PRODUTO" p (cost=0.00..4,047.59 rows=397 width=4) (actual time=0.007..14.838 rows=9,897 loops=1)

  • Filter: ("substring"(("ID_GRUPO")::text, 1, 2) = ANY ('{01,03}'::text[]))
27. 0.562 0.562 ↑ 1.0 1 281

Index Scan using idx_produto_produto on "PRODUTO" p (cost=0.00..3.70 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=281)

  • Index Cond: ("ID_PRODUTO" = pvi."ID_PRODUTO")
28. 0.003 9.441 ↑ 1.4 73 1

Nested Loop (cost=29.51..518.59 rows=102 width=5) (actual time=0.443..9.441 rows=73 loops=1)

29. 0.229 9.292 ↑ 1.4 73 1

Nested Loop (cost=29.51..139.64 rows=102 width=9) (actual time=0.436..9.292 rows=73 loops=1)

30. 0.323 0.323 ↓ 437.0 437 1

Index Scan using idx5_seg on "PEDVENDA" pv (cost=0.00..4.74 rows=1 width=12) (actual time=0.081..0.323 rows=437 loops=1)

  • Index Cond: ((("LIBERADO")::text = 'S'::text) AND (("AUTENTICA")::text = 'A'::text) AND ("DATEPED" >= '2014-01-01'::date) AND ("DATEPED" <= ('now'::text)::date) AND ("DATEPED" >= '2020-09-01'::date) AND ("DATEPED" <= '2020-09-01'::date) (...)
  • Filter: (("LIBERADO")::text = ANY ('{S,D}'::text[]))
31. 0.437 8.740 ↓ 0.0 0 437

Bitmap Heap Scan on "PEDV_ITEM" pvi (cost=29.51..134.12 rows=52 width=21) (actual time=0.020..0.020 rows=0 loops=437)

  • Recheck Cond: (("ID_FILIAL" = pv."ID_FILIAL") AND ("ID_PEDIDO" = pv."ID_PEDIDO") AND ("ID_PRODUTO" = ANY ('{8,9,32234,24259,7,1,6,5,3,4,26551,2}'::integer[])))
32. 8.303 8.303 ↓ 0.0 0 437

Bitmap Index Scan on idx5 (cost=0.00..29.50 rows=52 width=0) (actual time=0.019..0.019 rows=0 loops=437)

  • Index Cond: (("ID_FILIAL" = pv."ID_FILIAL") AND ("ID_PEDIDO" = pv."ID_PEDIDO") AND ("ID_PRODUTO" = ANY ('{8,9,32234,24259,7,1,6,5,3,4,26551,2}'::integer[])))
33. 0.146 0.146 ↑ 1.0 1 73

Index Scan using idx_produto_produto on "PRODUTO" p (cost=0.00..3.70 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=73)

  • Index Cond: ("ID_PRODUTO" = pvi."ID_PRODUTO")
Total runtime : 38.039 ms