explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WVkt

Settings
# exclusive inclusive rows x rows loops node
1. 128.719 63,232.967 ↓ 2,947.0 5,894 1

Unique (cost=35,387.63..35,387.72 rows=2 width=719) (actual time=63,051.123..63,232.967 rows=5,894 loops=1)

2. 551.519 63,104.248 ↓ 54,661.0 109,322 1

Sort (cost=35,387.63..35,387.63 rows=2 width=719) (actual time=63,051.122..63,104.248 rows=109,322 loops=1)

  • Sort Key: item.itp_id, item.itp_pedido_id, item.itp_oficio_id, item.itp_certidoes_nome_alternativo_id, item.itp_nome_oficio, item.itp_nome_cidade_oficio, item.itp_referencia_ged_ws, item.itp_centro_custo_id, item.itp_descricao_certidao, item.itp_uf_oficio, item.itp_data_hora_digitalizacao, item.itp_is_c24hs_site, item.itp_data_hora_baixa_certidao, item.itp_valor_certidao, item.itp_data_hora_pagamento, item.itp_valor_taxa_servico, ((SubPlan 1))
  • Sort Method: external merge Disk: 21,112kB
3. 187.753 62,552.729 ↓ 54,661.0 109,322 1

Nested Loop (cost=1.85..35,387.62 rows=2 width=719) (actual time=1,416.650..62,552.729 rows=109,322 loops=1)

  • Join Filter: (item.itp_centro_custo_id = c24_centro_custos.cec_id)
  • Rows Removed by Join Filter: 765,254
4. 0.010 0.010 ↑ 1.0 8 1

Seq Scan on c24_centro_custos (cost=0.00..1.08 rows=8 width=4) (actual time=0.005..0.010 rows=8 loops=1)

5. 229.709 61,599.712 ↓ 54,661.0 109,322 8

Materialize (cost=1.85..35,353.04 rows=2 width=203) (actual time=177.081..7,699.964 rows=109,322 loops=8)

6. 92.495 61,370.003 ↓ 54,661.0 109,322 1

Nested Loop (cost=1.85..35,353.03 rows=2 width=203) (actual time=1,416.613..61,370.003 rows=109,322 loops=1)

7. 33,230.033 61,168.186 ↓ 54,661.0 109,322 1

Nested Loop (cost=1.57..35,352.38 rows=2 width=207) (actual time=1,416.595..61,168.186 rows=109,322 loops=1)

  • Join Filter: (c24_pedidos.ped_cliente_id = c24_clientes.cli_id)
  • Rows Removed by Join Filter: 185,956,722
8. 1.525 1.525 ↑ 1.0 1,702 1

Seq Scan on c24_clientes (cost=0.00..53.36 rows=1,736 width=4) (actual time=0.003..1.525 rows=1,702 loops=1)

9. 27,499.609 27,936.628 ↓ 54,661.0 109,322 1,702

Materialize (cost=1.57..35,246.95 rows=2 width=211) (actual time=0.003..16.414 rows=109,322 loops=1,702)

10. 0.000 437.019 ↓ 54,661.0 109,322 1

Nested Loop (cost=1.57..35,246.94 rows=2 width=211) (actual time=0.035..437.019 rows=109,322 loops=1)

  • Join Filter: (item.itp_pedido_id = c24_pedidos.ped_id)
11. 41.515 225.858 ↓ 9,938.4 109,322 1

Nested Loop (cost=1.15..35,241.79 rows=11 width=211) (actual time=0.029..225.858 rows=109,322 loops=1)

  • Join Filter: (item.itp_oficio_id = c24_oficios.ofi_id)
12. 16.078 75.021 ↓ 165.4 109,322 1

Nested Loop (cost=0.86..35,031.41 rows=661 width=211) (actual time=0.022..75.021 rows=109,322 loops=1)

13. 5.897 5.897 ↓ 1.4 5,894 1

Index Scan using ndx_data_hora_digitalizacao on c24_itempedidos item (cost=0.43..807.07 rows=4,351 width=203) (actual time=0.013..5.897 rows=5,894 loops=1)

  • Index Cond: ((itp_data_hora_digitalizacao >= '2020-02-01 00:00:00'::timestamp without time zone) AND (itp_data_hora_digitalizacao <= '2020-02-10 23:59:59'::timestamp without time zone))
  • Filter: (itp_is_ativo AND (NOT itp_is_apostilamento_haia))
  • Rows Removed by Filter: 20
14. 53.046 53.046 ↓ 19.0 19 5,894

Index Only Scan using ndx_oficio_e_pedido on c24_agenda_historico_pendencia (cost=0.43..7.86 rows=1 width=8) (actual time=0.003..0.009 rows=19 loops=5,894)

  • Index Cond: ((ahp_oficio_id = item.itp_oficio_id) AND (ahp_pedido_id = item.itp_pedido_id))
  • Heap Fetches: 109,322
15. 109.322 109.322 ↑ 1.0 1 109,322

Index Scan using c24_oficios_pkey on c24_oficios (cost=0.29..0.31 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=109,322)

  • Index Cond: (ofi_id = c24_agenda_historico_pendencia.ahp_oficio_id)
16. 218.644 218.644 ↑ 1.0 1 109,322

Index Scan using c24_pedidos_pkey on c24_pedidos (cost=0.42..0.46 rows=1 width=8) (actual time=0.001..0.002 rows=1 loops=109,322)

  • Index Cond: (ped_id = c24_agenda_historico_pendencia.ahp_pedido_id)
  • Filter: (NOT ped_is_cancelado)
17. 109.322 109.322 ↑ 1.0 1 109,322

Index Only Scan using c24_cidades_pkey on c24_cidades (cost=0.29..0.32 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=109,322)

  • Index Cond: (cid_id = c24_oficios.ofi_cidade_id)
  • Heap Fetches: 109,322
18.          

SubPlan (for Nested Loop)

19. 109.322 765.254 ↑ 1.0 1 109,322

Limit (cost=0.58..16.63 rows=1 width=28) (actual time=0.006..0.007 rows=1 loops=109,322)

20. 0.008 655.932 ↑ 1.0 1 109,322

Nested Loop (cost=0.58..16.63 rows=1 width=28) (actual time=0.006..0.006 rows=1 loops=109,322)

21. 546.610 546.610 ↑ 1.0 1 109,322

Index Scan using ndx_oficio_e_pedido2 on c24_agenda_historico_pendencia c24_agenda_historico_pendencia_1 (cost=0.43..8.45 rows=1 width=12) (actual time=0.005..0.005 rows=1 loops=109,322)

  • Index Cond: ((ahp_oficio_id = item.itp_oficio_id) AND (ahp_pedido_id = item.itp_pedido_id))
  • Filter: (ahp_pendencia_id = 5)
  • Rows Removed by Filter: 6
22. 109.314 109.314 ↑ 1.0 1 109,314

Index Scan using c24_usuario_pkey on c24_usuario (cost=0.15..8.17 rows=1 width=24) (actual time=0.001..0.001 rows=1 loops=109,314)

  • Index Cond: (usu_id = c24_agenda_historico_pendencia_1.ahp_usuario_retorno_id)
Planning time : 3.471 ms
Execution time : 63,258.290 ms