explain.depesz.com

PostgreSQL's explain analyze made readable

Result: IQs6 : Optimization for: plan #mSwW

Settings

Optimization path:

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

Limit (cost=8.60..46.66 rows=1 width=682) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=8.60..4,114,414.26 rows=108,106 width=682) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=7.45..3,185,513.46 rows=108,106 width=527) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=6.30..2,508,097.05 rows=108,106 width=491) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=6.03..2,337,685.65 rows=108,106 width=476) (actual rows= loops=)

  • Merge Cond: (tr.refo_id = ct.refo_id)
  • Join Filter: (((rht.rht_inicio)::text <= (tr.to_hora_transacao)::text) AND ((rht.rht_termino)::text >= (tr.to_hora_transacao)::text))
6. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=5.75..2,333,491.54 rows=108,106 width=468) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=4.62..1,845,979.15 rows=108,106 width=444) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=4.05..1,564,447.97 rows=108,106 width=443) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3.78..1,417,983.96 rows=108,106 width=406) (actual rows= loops=)

  • Join Filter: (co.co_id = tr.co_id)
10. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3.78..1,302,804.24 rows=108,106 width=397) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=3.50..1,136,682.00 rows=108,106 width=381) (actual rows= loops=)

  • Merge Cond: (tr.refo_id = cl.refo_id)
  • Join Filter: ((rlt.co_id = tr.co_id) AND (rlt.rlt_terminal = tr.to_num_terminal))
12. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3.35..1,134,005.18 rows=108,106 width=362) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3.21..1,057,237.18 rows=108,106 width=355) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=2.92..885,871.46 rows=108,106 width=318) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=2.63..713,603.57 rows=108,106 width=301) (actual rows= loops=)

  • Merge Cond: (tr.refo_id = refo.refo_id)
16. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.73..705,791.67 rows=108,106 width=297) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.44..535,938.31 rows=108,106 width=259) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.01..338,423.21 rows=108,106 width=238) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Index Scan using idx_to_refo_acelerado_venda_transacao on transacoes_operadora tr (cost=0.57..107,913.94 rows=108,106 width=222) (actual rows= loops=)

  • Index Cond: ((refo_id = ANY ('{3287,3285,2605,3286,3283,3281}'::integer[])) AND (to_idt_acelerado = false) AND (to_data_venda >= '2019-07-01'::date) AND (to_data_venda <= '2019-09-10'::date) AND (to_tipo_transacao = 1))
  • Filter: (NOT to_idt_acelerado)
20. 0.000 0.000 ↓ 0.0

Index Scan using importacao_dados_at_pkey on importacao_dados_at ida (cost=0.43..2.13 rows=1 width=24) (actual rows= loops=)

  • Index Cond: (ida_id = tr.ida_id)
21. 0.000 0.000 ↓ 0.0

Index Scan using to_rede_pkey on to_rede rede (cost=0.43..1.83 rows=1 width=29) (actual rows= loops=)

  • Index Cond: (to_id = tr.to_id)
22. 0.000 0.000 ↓ 0.0

Index Scan using idx_to_moedas_id_idadata on to_moedas tm (cost=0.29..1.57 rows=1 width=46) (actual rows= loops=)

  • Index Cond: (to_id = tr.to_id)
23. 0.000 0.000 ↓ 0.0

Index Scan using rel_empresa_filial_operadora_pkey on rel_empresa_filial_operadora refo (cost=0.29..6,574.13 rows=10,682 width=8) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Index Scan using rel_empresa_filial_operadora_pr_pkey on rel_empresa_filial_operadora_pr refopr (cost=0.29..1.59 rows=1 width=25) (actual rows= loops=)

  • Index Cond: (refopr_id = tr.refopr_id)
25. 0.000 0.000 ↓ 0.0

Index Scan using cad_empresa_filial_pkey on cad_empresa_filial cef (cost=0.29..1.59 rows=1 width=41) (actual rows= loops=)

  • Index Cond: (cef_id = refo.cef_id)
26. 0.000 0.000 ↓ 0.0

Index Scan using cef_categoria_pkey on cef_categoria cct (cost=0.14..0.71 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (cef.cef_id = cef_id)
27. 0.000 0.000 ↓ 0.0

Materialize (cost=0.15..2,196.36 rows=447 width=35) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..2,195.24 rows=447 width=35) (actual rows= loops=)

  • Join Filter: (cl.cl_id = rlt.cl_id)
29. 0.000 0.000 ↓ 0.0

Index Scan using idx_cad_loja_fk_refo_id on cad_loja cl (cost=0.15..64.87 rows=316 width=31) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..12.70 rows=447 width=20) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Seq Scan on rel_loja_terminal rlt (cost=0.00..10.47 rows=447 width=20) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Index Scan using cad_empresa_grupo_pkey on cad_empresa_grupo ceg (cost=0.28..1.54 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (ceg_id = cef.ceg_id)
33. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..2.08 rows=72 width=13) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Seq Scan on cad_operadora co (cost=0.00..1.72 rows=72 width=13) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Index Scan using empresa_operadora_bandeira_tipo_produto_pkey on empresa_operadora_bandeira_tipo_produto eobtp (cost=0.27..1.36 rows=1 width=41) (actual rows= loops=)

  • Index Cond: (eobtp_id = tr.eobtp_id)
36. 0.000 0.000 ↓ 0.0

Index Scan using to_cartao_estrangeiro_pkey on to_cartao_estrangeiro tce (cost=0.57..2.60 rows=1 width=9) (actual rows= loops=)

  • Index Cond: (to_id = tr.to_id)
37. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.14..4.50 rows=1 width=48) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Index Scan using conciliacao_cliente_at_idx_cca_to on conciliacao_cliente_at cca (cost=0.57..2.61 rows=1 width=32) (actual rows= loops=)

  • Index Cond: (to_id = tr.to_id)
  • Filter: (ida_id_to = tr.ida_id)
39. 0.000 0.000 ↓ 0.0

Index Scan using idx_idcia_id_emissao on importacao_dados_cliente_item_at idcia (cost=0.57..1.89 rows=1 width=24) (actual rows= loops=)

  • Index Cond: (idcia_id = cca.idcia_id)
40. 0.000 0.000 ↓ 0.0

Materialize (cost=0.27..3,677.09 rows=490 width=28) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.27..3,675.87 rows=490 width=28) (actual rows= loops=)

  • Join Filter: (ct.ct_id = rht.ct_id)
42. 0.000 0.000 ↓ 0.0

Index Scan using idx_cad_turno_fk_refo_id on cad_turno ct (cost=0.27..61.24 rows=490 width=20) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..14.35 rows=490 width=24) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Seq Scan on rel_horario_turno rht (cost=0.00..11.90 rows=490 width=24) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Index Scan using cad_ajuste_conta_cac_banco_orig_cac_agencia_orig_cac_conta__key on cad_ajuste_conta cac (cost=0.28..1.58 rows=1 width=30) (actual rows= loops=)

  • Index Cond: ((tr.to_num_banco = cac_banco_orig) AND (tr.to_num_agencia = cac_agencia_orig) AND (tr.to_num_cc = cac_conta_orig))
46. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1.15..6.25 rows=1 width=60) (actual rows= loops=)

  • Group Key: po.refo_id, po.po_data_venda, po.co_id, cpa.to_id, cpa.cpa_data
47. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.15..6.22 rows=1 width=35) (actual rows= loops=)

  • Join Filter: (po.po_id = cpa.po_id)
48. 0.000 0.000 ↓ 0.0

Index Scan using conciliacao_pagamento_at_idx_cpa_data_to_status on conciliacao_pagamento_at cpa (cost=0.57..2.80 rows=1 width=20) (actual rows= loops=)

  • Index Cond: ((cpa_data = tr.to_data_venda) AND (to_id = tr.to_id) AND (cpa_status = 10))
49. 0.000 0.000 ↓ 0.0

Index Scan using idx_pocancelado_venda_refo_co on pagamentos_operadora po (cost=0.57..3.40 rows=2 width=31) (actual rows= loops=)

  • Index Cond: ((po_data_venda = tr.to_data_venda) AND (refo_id = tr.refo_id) AND (co_id = tr.co_id))
  • Filter: ((NOT po_idt_acelerado) AND (po_tipo_transacao = 1) AND (po_data_pagto <= CURRENT_DATE))
50. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1.15..5.63 rows=1 width=28) (actual rows= loops=)

  • Group Key: po_1.refo_id, po_1.po_data_venda, po_1.co_id, cpa_1.to_id, cpa_1.cpa_data
51. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.15..5.61 rows=1 width=28) (actual rows= loops=)

  • Join Filter: (po_1.po_id = cpa_1.po_id)
52. 0.000 0.000 ↓ 0.0

Index Scan using idx_po_refo_co_venda_transacao_parcela on pagamentos_operadora po_1 (cost=0.57..2.80 rows=1 width=24) (actual rows= loops=)

  • Index Cond: ((refo_id = tr.refo_id) AND (co_id = tr.co_id) AND (po_data_venda = tr.to_data_venda) AND (po_tipo_transacao = 3))
53. 0.000 0.000 ↓ 0.0

Index Scan using conciliacao_pagamento_at_idx_cpa_data_to_status on conciliacao_pagamento_at cpa_1 (cost=0.57..2.80 rows=1 width=20) (actual rows= loops=)

  • Index Cond: ((cpa_data = tr.to_data_venda) AND (to_id = tr.to_id) AND (cpa_status = 10))
54.          

SubPlan (forNested Loop Left Join)

55. 0.000 0.000 ↓ 0.0

Index Scan using idx_tocancelado_venda_refo_co on transacoes_operadora tocanc (cost=0.42..2.65 rows=1 width=0) (actual rows= loops=)

  • Index Cond: ((to_data_venda = tr.to_data_venda) AND (refo_id = tr.refo_id) AND (co_id = tr.co_id))
  • Filter: (to_codigo = tr.to_codigo)