explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ojAn : Optimization for: Optimization for: plan #KsCc; plan #FB2g

Settings

Optimization path:

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

Aggregate (cost=137,988.92..137,988.93 rows=1 width=5) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop (cost=267.44..137,908.94 rows=7,998 width=5) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Hash Join (cost=267.15..135,271.04 rows=7,998 width=20) (actual rows= loops=)

  • Hash Cond: (pedido.revenda_id = revenda.revenda_id)
4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.29..134,894.21 rows=7,998 width=24) (actual rows= loops=)

  • Join Filter: (((pedido.revenda_id = fr_usuario.revenda_id) OR (fr_usuario.revenda_id = 0)) AND ((fr_usuario.usr_vendedor = 'N'::bpchar) OR (pedido.usr_codigo = 44782)))
5. 0.000 0.000 ↓ 0.0

Index Scan using fr_usuario_pkey on fr_usuario (cost=0.29..8.31 rows=1 width=6) (actual rows= loops=)

  • Index Cond: (usr_codigo = 44782)
6. 0.000 0.000 ↓ 0.0

Seq Scan on pedido (cost=0.00..115,367.30 rows=975,930 width=28) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Hash (cost=249.32..249.32 rows=1,403 width=4) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Index Only Scan using revenda_pkey on revenda (cost=0.28..249.32 rows=1,403 width=4) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Index Only Scan using cliente_cnpj_unique on cliente (cost=0.29..0.32 rows=1 width=14) (actual rows= loops=)