explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CwMB

Settings
# exclusive inclusive rows x rows loops node
1. 4.238 526,213.085 ↓ 0.0 0 1

Update on negociacao_cobranca controle (cost=168,329.41..168,331.45 rows=1 width=160) (actual time=526,213.085..526,213.085 rows=0 loops=1)

2. 0.010 526,208.847 ↑ 1.0 1 1

Nested Loop (cost=168,329.41..168,331.45 rows=1 width=160) (actual time=526,208.840..526,208.847 rows=1 loops=1)

3. 0.031 526,208.784 ↑ 1.0 1 1

Subquery Scan on fila (cost=168,328.99..168,329.01 rows=1 width=56) (actual time=526,208.778..526,208.784 rows=1 loops=1)

4. 0.000 526,208.753 ↑ 1.0 1 1

Limit (cost=168,328.99..168,329.00 rows=1 width=46) (actual time=526,208.749..526,208.753 rows=1 loops=1)

5.          

Initplan (for Limit)

6. 0.011 0.011 ↑ 1.0 1 1

Index Scan using pk_oprto on operador_autoatendimento oa1 (cost=0.28..2.30 rows=1 width=3) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: (id_operador_autoatendimento = 1000000)
7. 0.969 526,208.748 ↑ 1.0 1 1

Sort (cost=168,326.69..168,326.70 rows=1 width=46) (actual time=526,208.748..526,208.748 rows=1 loops=1)

  • Sort Key: enc.ts_prioriza_negociacao, (min(bn1.dt_vencimento_boleto)), nc.ts_operador_atendimento
  • Sort Method: top-N heapsort Memory: 25kB
8. 6,433.913 526,207.779 ↓ 269.0 269 1

Nested Loop (cost=35,854.14..168,326.68 rows=1 width=46) (actual time=2,796.694..526,207.779 rows=269 loops=1)

  • Join Filter: (nc.id_negociacao_cobranca = bn1.id_negociacao_cobranca)
  • Rows Removed by Join Filter: 53980558
9. 38.068 905.953 ↓ 269.0 269 1

Nested Loop (cost=35,853.71..55,959.47 rows=1 width=50) (actual time=315.555..905.953 rows=269 loops=1)

  • Join Filter: (enc.id_operador_autoatendimento = oa.id_operador_autoatendimento)
  • Rows Removed by Join Filter: 266041
10. 7.830 832.108 ↓ 269.0 269 1

Nested Loop Left Join (cost=35,853.71..55,866.21 rows=1 width=58) (actual time=315.412..832.108 rows=269 loops=1)

  • Join Filter: (ro.id_ocorrencia = o.id_ocorrencia)
  • Rows Removed by Join Filter: 28514
  • Filter: ((enc.id_registro_ocorrencia IS NULL) OR (o.in_retornar_fila IS FALSE))
11. 0.773 820.512 ↓ 269.0 269 1

Nested Loop Left Join (cost=35,853.71..55,860.83 rows=1 width=68) (actual time=315.386..820.512 rows=269 loops=1)

12. 1.563 819.470 ↓ 269.0 269 1

Nested Loop (cost=35,853.14..55,858.30 rows=1 width=66) (actual time=315.379..819.470 rows=269 loops=1)

13. 112.926 812.122 ↓ 445.0 445 1

Hash Join (cost=35,852.71..55,856.45 rows=1 width=66) (actual time=315.347..812.122 rows=445 loops=1)

  • Hash Cond: ((nc.id_negociacao_cobranca = enc.id_negociacao_cobranca) AND (nc.id_estado_negociacao_cobranca = enc.id_estado_negociacao_cobranca))
14. 384.054 384.054 ↓ 2.6 383,491 1

Seq Scan on negociacao_cobranca nc (cost=0.00..19,241.65 rows=145,160 width=34) (actual time=0.017..384.054 rows=383,491 loops=1)

  • Filter: ((id_tipo_negociacao_cobranca = 1) AND ((ts_operador_atendimento IS NULL) OR ((ts_operador_atendimento + ('10 minutes'::cstring)::interval) < now())))
  • Rows Removed by Filter: 76455
15. 9.502 315.142 ↑ 1.0 30,419 1

Hash (cost=35,395.04..35,395.04 rows=30,511 width=48) (actual time=315.142..315.142 rows=30,419 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 2177kB
16. 305.640 305.640 ↑ 1.0 30,419 1

Seq Scan on estado_negociacao_cobranca enc (cost=0.00..35,395.04 rows=30,511 width=48) (actual time=2.774..305.640 rows=30,419 loops=1)

  • Filter: (id_tipo_estado_negociacao_cobranca = ANY ('{17}'::smallint[]))
  • Rows Removed by Filter: 1200439
17. 5.785 5.785 ↑ 1.0 1 445

Index Scan using pk_atnto on atendimento_pessoa ap (cost=0.44..1.85 rows=1 width=16) (actual time=0.013..0.013 rows=1 loops=445)

  • Index Cond: (id_atendimento_pessoa = nc.id_atendimento_pessoa)
  • Filter: (sg_uf_local_atendimento = $0)
  • Rows Removed by Filter: 0
18. 0.269 0.269 ↓ 0.0 0 269

Index Scan using pk_registro_ocorrencia on registro_ocorrencia ro (cost=0.57..2.53 rows=1 width=10) (actual time=0.001..0.001 rows=0 loops=269)

  • Index Cond: (id_registro_ocorrencia = enc.id_registro_ocorrencia)
19. 3.766 3.766 ↑ 1.0 106 269

Seq Scan on ocorrencia o (cost=0.00..4.06 rows=106 width=3) (actual time=0.002..0.014 rows=106 loops=269)

20. 35.777 35.777 ↑ 2.7 990 269

Seq Scan on operador_autoatendimento oa (cost=0.00..59.78 rows=2,678 width=8) (actual time=0.005..0.133 rows=990 loops=269)

21. 122,743.893 518,867.913 ↓ 1.2 200,672 269

GroupAggregate (cost=0.43..108,693.35 rows=163,283 width=12) (actual time=0.039..1,928.877 rows=200,672 loops=269)

  • Group Key: bn1.id_negociacao_cobranca
22. 396,124.020 396,124.020 ↑ 1.6 1,952,468 269

Index Scan using pk_boleto_negociacao on boleto_negociacao bn1 (cost=0.43..91,741.10 rows=3,063,884 width=12) (actual time=0.009..1,472.580 rows=1,952,468 loops=269)

  • Filter: (dt_pagamento_boleto IS NULL)
  • Rows Removed by Filter: 301917
23. 0.053 0.053 ↑ 1.0 1 1

Index Scan using ix05_negociacao_cobranca on negociacao_cobranca controle (cost=0.42..2.44 rows=1 width=104) (actual time=0.052..0.053 rows=1 loops=1)

  • Index Cond: (id_negociacao_cobranca = fila.id_negociacao_cobranca)
Planning time : 5.075 ms
Execution time : 526,213.348 ms