explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JyUw

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.045 0.413 ↓ 0.0 0 1

Sort (cost=89.83..89.85 rows=7 width=192) (actual time=0.413..0.413 rows=0 loops=1)

  • Sort Key: (COALESCE((SubPlan 1), '0'::numeric)) DESC, cmo.cmo_id DESC, (CASE WHEN (clor.co1_orden IS NULL) THEN $3 ELSE clor.co1_orden END), pro.pro_nombre
  • Sort Method: quicksort Memory: 25kB
2.          

Initplan (forSort)

3. 0.000 0.000 ↓ 0.0 0

Result (cost=0.31..0.32 rows=1 width=4) (never executed)

4.          

Initplan (forResult)

5. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.27..0.31 rows=1 width=4) (never executed)

6. 0.000 0.000 ↓ 0.0 0

Index Only Scan Backward using clasificacion1_pk on clasificacion1 (cost=0.27..17.63 rows=436 width=4) (never executed)

  • Index Cond: (cla1_id IS NOT NULL)
  • Heap Fetches: 0
7. 0.000 0.368 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.71..89.41 rows=7 width=192) (actual time=0.368..0.368 rows=0 loops=1)

8. 0.000 0.368 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.56..52.74 rows=7 width=156) (actual time=0.368..0.368 rows=0 loops=1)

9. 0.001 0.368 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.28..50.45 rows=7 width=152) (actual time=0.368..0.368 rows=0 loops=1)

10. 0.000 0.367 ↓ 0.0 0 1

Nested Loop Left Join (cost=2.14..49.28 rows=7 width=150) (actual time=0.367..0.367 rows=0 loops=1)

11. 0.005 0.368 ↓ 0.0 0 1

Nested Loop (cost=1.86..47.10 rows=7 width=68) (actual time=0.367..0.368 rows=0 loops=1)

12. 0.003 0.147 ↑ 1.0 9 1

Nested Loop (cost=1.57..21.48 rows=9 width=72) (actual time=0.131..0.147 rows=9 loops=1)

13. 0.001 0.112 ↑ 1.0 1 1

Nested Loop Left Join (cost=1.15..20.42 rows=1 width=56) (actual time=0.109..0.112 rows=1 loops=1)

14. 0.010 0.099 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.86..20.09 rows=1 width=32) (actual time=0.096..0.099 rows=1 loops=1)

15. 0.010 0.080 ↑ 1.0 1 1

Nested Loop (cost=0.58..17.58 rows=1 width=16) (actual time=0.078..0.080 rows=1 loops=1)

16. 0.034 0.034 ↑ 1.0 1 1

Index Scan using cfactura_pkey on cfactura cfa (cost=0.29..15.06 rows=1 width=12) (actual time=0.033..0.034 rows=1 loops=1)

  • Index Cond: (cfa_id = ANY (('{" 35111"}'::text[])::integer[]))
17. 0.036 0.036 ↑ 1.0 1 1

Index Only Scan using cfacnen_uk_facnotaent on cfacnen nen (cost=0.29..2.51 rows=1 width=8) (actual time=0.035..0.036 rows=1 loops=1)

  • Index Cond: (cfa_id = cfa.cfa_id)
  • Heap Fetches: 1
18. 0.009 0.009 ↑ 1.0 1 1

Index Only Scan using idx_clu_cliente on cliente cli (cost=0.28..2.50 rows=1 width=20) (actual time=0.009..0.009 rows=1 loops=1)

  • Index Cond: (cli_id = cfa.cli_id)
  • Heap Fetches: 1
19. 0.012 0.012 ↑ 1.0 1 1

Index Scan using pk_entidad on entidad ent (cost=0.28..0.32 rows=1 width=32) (actual time=0.012..0.012 rows=1 loops=1)

  • Index Cond: (ent_id = cli.ent_id)
20. 0.032 0.032 ↑ 1.9 9 1

Index Scan using dmovinv_llave_cabecera on dmovinv dmo (cost=0.42..0.89 rows=17 width=16) (actual time=0.021..0.032 rows=9 loops=1)

  • Index Cond: (cmo_id = nen.cmo_id)
21. 0.072 0.216 ↓ 0.0 0 9

Index Only Scan using cmovinv_pkey on cmovinv cmo (cost=0.29..2.84 rows=1 width=4) (actual time=0.024..0.024 rows=0 loops=9)

  • Index Cond: (cmo_id = dmo.cmo_id)
  • Filter: (COALESCE((SubPlan 5), '0'::numeric) <> dmo.dmo_cantidad)
  • Rows Removed by Filter: 1
  • Heap Fetches: 9
22.          

SubPlan (forIndex Only Scan)

23. 0.036 0.144 ↑ 1.0 1 9

Aggregate (cost=2.51..2.52 rows=1 width=32) (actual time=0.016..0.016 rows=1 loops=9)

24. 0.108 0.108 ↓ 4.0 4 9

Index Scan using idx_dfactura_despacho_cmoid_proid on dfactura_despacho dd_2 (cost=0.29..2.51 rows=1 width=5) (actual time=0.011..0.012 rows=4 loops=9)

  • Index Cond: ((cmo_id = cmo.cmo_id) AND (pro_id = dmo.pro_id))
25. 0.000 0.000 ↓ 0.0 0

Index Scan using producto_pkey on producto pro (cost=0.28..0.30 rows=1 width=82) (never executed)

  • Index Cond: (pro_id = dmo.pro_id)
26. 0.000 0.000 ↓ 0.0 0

Index Scan using marca_pkey on marca mar (cost=0.14..0.16 rows=1 width=10) (never executed)

  • Index Cond: (mar_id = pro.mar_id)
27. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_producto1_producto on producto1 pro1 (cost=0.28..0.32 rows=1 width=8) (never executed)

  • Index Cond: (pro_id = pro.pro_id)
28. 0.000 0.000 ↓ 0.0 0

Index Scan using uk_clasificacion1_orden on clasificacion1_orden clor (cost=0.14..0.16 rows=1 width=8) (never executed)

  • Index Cond: (cla1_id = pro.cla1_id)
29.          

SubPlan (forNested Loop Left Join)

30. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=2.51..2.52 rows=1 width=32) (never executed)

31. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_dfactura_despacho_cmoid_proid on dfactura_despacho dd (cost=0.29..2.51 rows=1 width=5) (never executed)

  • Index Cond: ((cmo_id = cmo.cmo_id) AND (pro_id = dmo.pro_id))
32. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=2.51..2.52 rows=1 width=32) (never executed)

33. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_dfactura_despacho_cmoid_proid on dfactura_despacho dd_1 (cost=0.29..2.51 rows=1 width=5) (never executed)

  • Index Cond: ((cmo_id = cmo.cmo_id) AND (pro_id = dmo.pro_id))