explain.depesz.com

PostgreSQL's explain analyze made readable

Result: XLIL

Settings
# exclusive inclusive rows x rows loops node
1. 118.017 94,290.230 ↓ 0.0 0 1

Update on altera_preco_produto (cost=0.84..251,614.84 rows=121 width=154) (actual time=94,290.230..94,290.230 rows=0 loops=1)

2. 3.933 94,172.213 ↓ 8.3 1,000 1

Nested Loop (cost=0.84..251,614.84 rows=121 width=154) (actual time=449.227..94,172.213 rows=1,000 loops=1)

3. 1.196 94,158.280 ↓ 8.3 1,000 1

Subquery Scan on dad (cost=0.42..251,303.90 rows=121 width=96) (actual time=449.211..94,158.280 rows=1,000 loops=1)

4. 0.317 94,157.084 ↓ 8.3 1,000 1

Limit (cost=0.42..251,302.69 rows=121 width=36) (actual time=449.208..94,157.084 rows=1,000 loops=1)

5. 20.484 94,156.767 ↓ 8.3 1,000 1

Nested Loop (cost=0.42..251,302.69 rows=121 width=36) (actual time=449.207..94,156.767 rows=1,000 loops=1)

6. 34.659 34.659 ↓ 88.0 122,312 1

Seq Scan on altera_preco_produto app (cost=0.00..5,316.00 rows=1,390 width=12) (actual time=0.121..34.659 rows=122,312 loops=1)

  • Filter: (app_vl_preco_custo IS NULL)
  • Rows Removed by Filter: 4217
7. 244.624 244.624 ↓ 0.0 0 122,312

Index Scan using altera_preco_pkey on altera_preco alp (cost=0.42..1.60 rows=1 width=20) (actual time=0.002..0.002 rows=0 loops=122,312)

  • Index Cond: (alp_cd_altera_preco = app.app_cd_altera_preco)
  • Filter: (alp_dt_alteracao >= '2020-02-01'::date)
  • Rows Removed by Filter: 1
8.          

SubPlan (for Nested Loop)

9. 1.000 93,857.000 ↑ 1.0 1 1,000

Limit (cost=2,014.53..2,014.54 rows=1 width=32) (actual time=93.857..93.857 rows=1 loops=1,000)

10. 3,430.000 93,856.000 ↑ 1.0 1 1,000

Aggregate (cost=2,014.53..2,014.54 rows=1 width=32) (actual time=93.856..93.856 rows=1 loops=1,000)

11. 3,200.920 90,426.000 ↓ 2.8 1,659 1,000

Nested Loop (cost=0.58..1,861.06 rows=596 width=40) (actual time=43.129..90.426 rows=1,659 loops=1,000)

12. 42,415.000 42,415.000 ↓ 7.5 4,481 1,000

Index Scan using venda_ven_cd_unidade_negocio_ven_ts_venda on venda ven (cost=0.57..663.09 rows=596 width=1,425) (actual time=0.058..42.415 rows=4,481 loops=1,000)

  • Index Cond: ((ven_cd_unidade_negocio = alp.alp_cd_unidade_negocio) AND (ven_fl_cancelada = 'N'::bpchar) AND (ven_ts_venda >= (alp.alp_dt_alteracao - '15 days'::interval)) AND (ven_ts_venda <= (alp.alp_dt_alteracao + alp.alp_tm_alteracao)))
13. 44,810.080 44,810.080 ↓ 0.0 0 4,481,008

Function Scan on jsonb_array_elements vei (cost=0.01..2.00 rows=1 width=32) (actual time=0.010..0.010 rows=0 loops=4,481,008)

  • Filter: (((value ->> 'vei_cd_produto'::text))::integer = app.app_cd_produto)
  • Rows Removed by Filter: 2
14. 10.000 10.000 ↑ 1.0 1 1,000

Index Scan using altera_preco_produto_pkey on altera_preco_produto (cost=0.42..2.57 rows=1 width=50) (actual time=0.010..0.010 rows=1 loops=1,000)

  • Index Cond: (app_cd_altera_preco_produto = dad.codigo)
Planning time : 2.680 ms
Execution time : 94,309.595 ms
Trigger times:
Trigger Name:Total time:Calls:Average time:
altera_preco_produto_custo 11.657 ms 1000 0.012 ms