explain.depesz.com

A tool for finding a real cause for slow queries.

Result: Y19i

options
exclusive inclusive rows x rows loops node
0.459 4226.865 ↓ 21.0 21 1

HashAggregate (cost=435355.74..435355.76 rows=1 width=97) (actual time=4226.821..4226.865 rows=21 loops=1)

36.360 4226.406 ↓ 21.0 21 1

Nested Loop (cost=0.00..435355.72 rows=1 width=97) (actual time=522.770..4226.406 rows=21 loops=1)

19.492 119.310 ↓ 28.4 6282 1

Nested Loop (cost=0.00..1039.01 rows=221 width=73) (actual time=0.325..119.310 rows=6282 loops=1)

9.230 9.230 ↑ 1.0 3 1

Seq Scan on embalagem embalagem2_ (cost=0.00..526.67 rows=3 width=44) (actual time=0.183..9.230 rows=3 loops=1)

  • Filter: (id = ANY ('{35856,434915,23085}'::bigint[]))
90.588 90.588 ↓ 28.3 2094 3

Index Scan using idx_itemvenda_status_embalagemid on itemvenda itens1_ (cost=0.00..169.85 rows=74 width=37) (actual time=0.118..30.196 rows=2094 loops=3)

  • Index Cond: ((itens1_.status = 'F'::bpchar) AND (itens1_.embalagemid = embalagem2_.id))
121.140 4070.736 ↓ 0.0 0 6282

Index Scan using pk_venda on venda venda0_ (cost=0.00..1965.22 rows=1 width=32) (actual time=0.648..0.648 rows=0 loops=6282)

  • Index Cond: (venda0_.id = itens1_.vendaid)
  • Filter: ((venda0_.datahorafechamento >= '2012-01-06 00:00:00'::timestamp without time zone) AND (venda0_.datahorafechamento <= '2012-01-06 23:59:59'::timestamp without time zone) AND (venda0_.unidadenegocioid = ANY ('{1,563794,563795}'::bigint[])) AND ((venda0_.status = 'F'::bpchar) OR (venda0_.status = 'D'::bpchar)) AND (NOT (SubPlan 1)))
         

SubPlan (forIndex Scan)

631.890 3949.596 ↓ 0.0 0 21

Nested Loop (cost=190.61..1964.87 rows=1 width=0) (actual time=188.076..188.076 rows=0 loops=21)

1389.792 2556.918 ↓ 4.7 6038 21

Hash Join (cost=190.61..1142.61 rows=1287 width=8) (actual time=0.733..121.758 rows=6038 loops=21)

  • Hash Cond: (pagamentov5_.clienteid = cliente7_.id)
1152.060 1152.060 ↑ 1.0 42482 21

Seq Scan on pagamentovendacrediario pagamentov5_ (cost=0.00..779.82 rows=42482 width=16) (actual time=0.008..54.860 rows=42482 loops=21)

0.148 15.066 ↑ 1.8 88 1

Hash (cost=188.63..188.63 rows=159 width=8) (actual time=15.066..15.066 rows=88 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 3kB
6.975 14.918 ↑ 1.8 88 1

Hash Join (cost=2.86..188.63 rows=159 width=8) (actual time=0.145..14.918 rows=88 loops=1)

  • Hash Cond: (cliente7_.crediarioid = crediario8_.id)
7.868 7.868 ↑ 1.0 5249 1

Seq Scan on cliente cliente7_ (cost=0.00..164.49 rows=5249 width=16) (actual time=0.027..7.868 rows=5249 loops=1)

0.010 0.075 ↑ 1.0 2 1

Hash (cost=2.84..2.84 rows=2 width=8) (actual time=0.075..0.075 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
0.065 0.065 ↑ 1.0 2 1

Seq Scan on crediario crediario8_ (cost=0.00..2.84 rows=2 width=8) (actual time=0.030..0.065 rows=2 loops=1)

  • Filter: (id = ANY ('{122047,122048}'::bigint[]))
760.788 760.788 ↓ 0.0 0 126798

Index Scan using pk_pagamentovenda on pagamentovenda pagamentov6_ (cost=0.00..0.63 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=126798)

  • Index Cond: (pagamentov6_.id = pagamentov5_.pagamentovendaid)
  • Filter: (pagamentov6_.vendaid = $0)