explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WRH

Settings
# exclusive inclusive rows x rows loops node
1. 2.464 2,525.706 ↓ 0.0 0 1

Update on altera_preco_produto (cost=0.84..6,866.03 rows=100 width=154) (actual time=2,525.705..2,525.706 rows=0 loops=1)

2. 0.164 2,523.242 ↑ 1.0 100 1

Nested Loop (cost=0.84..6,866.03 rows=100 width=154) (actual time=258.157..2,523.242 rows=100 loops=1)

3. 0.056 2,522.778 ↑ 1.0 100 1

Subquery Scan on dad (cost=0.42..6,607.28 rows=100 width=96) (actual time=258.145..2,522.778 rows=100 loops=1)

4. 0.017 2,522.722 ↑ 1.0 100 1

Limit (cost=0.42..6,606.28 rows=100 width=36) (actual time=258.142..2,522.722 rows=100 loops=1)

5. 0.000 2,522.705 ↑ 1.2 100 1

Nested Loop (cost=0.42..7,993.51 rows=121 width=36) (actual time=258.142..2,522.705 rows=100 loops=1)

6. 25.518 25.518 ↓ 84.9 117,985 1

Seq Scan on altera_preco_produto app (cost=0.00..5,316.00 rows=1,390 width=12) (actual time=0.013..25.518 rows=117,985 loops=1)

  • Filter: (app_vl_preco_custo IS NULL)
  • Rows Removed by Filter: 2794
7. 235.970 235.970 ↓ 0.0 0 117,985

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=117,985)

  • 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. 0.100 2,263.700 ↓ 0.0 0 100

Limit (cost=0.58..3.72 rows=1 width=40) (actual time=22.637..22.637 rows=0 loops=100)

10. 0.800 2,263.600 ↓ 0.0 0 100

WindowAgg (cost=0.58..1,874.47 rows=596 width=40) (actual time=22.636..22.636 rows=0 loops=100)

11. 27.356 2,262.800 ↑ 198.7 3 100

Nested Loop (cost=0.58..1,861.06 rows=596 width=40) (actual time=18.106..22.628 rows=3 loops=100)

12. 1,676.100 1,676.100 ↑ 1.3 466 100

Index Scan Backward 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.053..16.761 rows=466 loops=100)

  • 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. 559.344 559.344 ↓ 0.0 0 46,612

Function Scan on jsonb_array_elements vei (cost=0.01..2.00 rows=1 width=32) (actual time=0.012..0.012 rows=0 loops=46,612)

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

Index Scan using altera_preco_produto_pkey on altera_preco_produto (cost=0.42..2.58 rows=1 width=50) (actual time=0.003..0.003 rows=1 loops=100)

  • Index Cond: (app_cd_altera_preco_produto = dad.codigo)
Planning time : 1.619 ms
Execution time : 2,525.819 ms
Trigger times:
Trigger Name:Total time:Calls:Average time:
altera_preco_produto_custo 0.453 ms 100 0.005 ms