explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Ufhj

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

Nested Loop (cost=13,172.77..25,432,430.77 rows=4,043 width=309) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop (cost=13,172.63..41,278.60 rows=4,043 width=127) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Merge Join (cost=13,172.35..39,912.59 rows=4,043 width=72) (actual rows= loops=)

  • Merge Cond: (c24_agenda_oficio_pedido.aop_pedido_id = c24_pedidos.ped_id)
4. 0.000 0.000 ↓ 0.0

Index Scan using ndx_pedido_id on c24_agenda_oficio_pedido (cost=0.42..26,318.47 rows=142,888 width=16) (actual rows= loops=)

  • Filter: ((aop_pendencia_id <> 99) AND (aop_pendencia_id = ANY ('{1,2,3,4,5,6,98}'::integer[])))
5. 0.000 0.000 ↓ 0.0

Sort (cost=13,171.74..13,184.13 rows=4,956 width=60) (actual rows= loops=)

  • Sort Key: c24_pedidos.ped_id
6. 0.000 0.000 ↓ 0.0

Hash Join (cost=58.49..12,867.56 rows=4,956 width=60) (actual rows= loops=)

  • Hash Cond: (c24_pedidos.ped_cliente_id = c24_clientes.cli_id)
7. 0.000 0.000 ↓ 0.0

Seq Scan on c24_pedidos (cost=0.00..12,735.53 rows=6,395 width=64) (actual rows= loops=)

  • Filter: ((NOT ped_is_cancelado) AND (NOT ped_is_finalizado) AND (ped_data_controle IS NOT NULL) AND (ped_projeto <> 2) AND (ped_data_hora_criacao >= '2012-01-01 00:00:00'::timestamp without time zone) AND (ped_pedido_status_id = ANY ('{2,3,4}'::integer[])))
8. 0.000 0.000 ↓ 0.0

Hash (cost=43.98..43.98 rows=1,161 width=4) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Seq Scan on c24_clientes (cost=0.00..43.98 rows=1,161 width=4) (actual rows= loops=)

  • Filter: cli_ativo
10. 0.000 0.000 ↓ 0.0

Index Scan using c24_oficios_pkey on c24_oficios (cost=0.29..0.33 rows=1 width=59) (actual rows= loops=)

  • Index Cond: (ofi_id = c24_agenda_oficio_pedido.aop_oficio_id)
11. 0.000 0.000 ↓ 0.0

Index Scan using c24_pendencias_pkey on c24_pendencias (cost=0.14..0.16 rows=1 width=122) (actual rows= loops=)

  • Index Cond: (pen_id = c24_agenda_oficio_pedido.aop_pendencia_id)
12.          

SubPlan (forNested Loop)

13. 0.000 0.000 ↓ 0.0

Aggregate (cost=8.45..8.46 rows=1 width=8) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Index Scan using ndx_pedido_id_oficio_id on c24_itempedidos item (cost=0.42..8.45 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((itp_pedido_id = c24_agenda_oficio_pedido.aop_pedido_id) AND (itp_oficio_id = c24_agenda_oficio_pedido.aop_oficio_id))
  • Filter: ((itp_data_hora_digitalizacao IS NULL) AND itp_is_ativo)
15. 0.000 0.000 ↓ 0.0

Aggregate (cost=14.98..14.99 rows=1 width=8) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Index Scan using ndx_data on c24_dias_ano (cost=0.29..14.56 rows=167 width=4) (actual rows= loops=)

  • Index Cond: ((dia_data >= c24_pedidos.ped_data_inicio_producao) AND (dia_data <= now()))
  • Filter: (dia_dia_semana <> ALL ('{6,0}'::integer[]))
17. 0.000 0.000 ↓ 0.0

Aggregate (cost=3,116.60..3,116.61 rows=1 width=8) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Seq Scan on c24_agenda_historico_obs_cliente (cost=0.00..3,116.60 rows=1 width=8) (actual rows= loops=)

  • Filter: ((aoc_pedido_id = c24_agenda_oficio_pedido.aop_pedido_id) AND (aoc_oficio_id = c24_agenda_oficio_pedido.aop_oficio_id))
19. 0.000 0.000 ↓ 0.0

Limit (cost=3,116.61..3,116.61 rows=1 width=64) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Sort (cost=3,116.61..3,116.61 rows=1 width=64) (actual rows= loops=)

  • Sort Key: c24_agenda_historico_obs_cliente_1.aoc_id DESC
21. 0.000 0.000 ↓ 0.0

Seq Scan on c24_agenda_historico_obs_cliente c24_agenda_historico_obs_cliente_1 (cost=0.00..3,116.60 rows=1 width=64) (actual rows= loops=)

  • Filter: ((aoc_pedido_id = c24_agenda_oficio_pedido.aop_pedido_id) AND (aoc_oficio_id = c24_agenda_oficio_pedido.aop_oficio_id))
22. 0.000 0.000 ↓ 0.0

Aggregate (cost=23.44..23.45 rows=1 width=8) (actual rows= loops=)

23.          

Initplan (forAggregate)

24. 0.000 0.000 ↓ 0.0

Limit (cost=8.46..8.46 rows=1 width=12) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Sort (cost=8.46..8.46 rows=1 width=12) (actual rows= loops=)

  • Sort Key: agendahistorico.ahp_id DESC
26. 0.000 0.000 ↓ 0.0

Index Scan using c24_agenda_historico_pendencia_ahp_pedido_id_idx on c24_agenda_historico_pendencia agendahistorico (cost=0.43..8.45 rows=1 width=12) (actual rows= loops=)

  • Index Cond: ((ahp_pedido_id = c24_agenda_oficio_pedido.aop_pedido_id) AND (ahp_oficio_id = c24_agenda_oficio_pedido.aop_oficio_id))
27. 0.000 0.000 ↓ 0.0

Index Scan using ndx_data on c24_dias_ano c24_dias_ano_1 (cost=0.29..14.56 rows=167 width=4) (actual rows= loops=)

  • Index Cond: ((dia_data >= $9) AND (dia_data <= now()))
  • Filter: (dia_dia_semana <> ALL ('{6,0}'::integer[]))