explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vMKA

Settings
# exclusive inclusive rows x rows loops node
1. 63.694 1,032.992 ↓ 86,581.0 86,581 1

Nested Loop (cost=20,928.44..27,582.84 rows=1 width=462) (actual time=337.171..1,032.992 rows=86,581 loops=1)

2. 4.239 882.717 ↓ 86,581.0 86,581 1

Nested Loop (cost=20,928.16..27,574.26 rows=1 width=123) (actual time=337.137..882.717 rows=86,581 loops=1)

3. 64.967 791.897 ↓ 86,581.0 86,581 1

Nested Loop (cost=20,928.03..27,574.10 rows=1 width=122) (actual time=337.128..791.897 rows=86,581 loops=1)

4. 79.237 640.349 ↓ 86,581.0 86,581 1

Nested Loop (cost=20,927.74..27,573.74 rows=1 width=128) (actual time=337.117..640.349 rows=86,581 loops=1)

  • Join Filter: ((enc.id_atendimento_cliente = nc.id_atendimento_cliente) AND (enc.id_negociacao_cobranca = nc.id_negociacao_cobranca))
5. 55.345 474.531 ↓ 86,581.0 86,581 1

Merge Join (cost=20,927.44..27,573.36 rows=1 width=144) (actual time=337.074..474.531 rows=86,581 loops=1)

  • Merge Cond: ((enc.id_atendimento_cliente = b.id_atendimento_cliente) AND (enc.id_negociacao_cobranca = b.id_negociacao_cobranca))
  • Join Filter: (enc2.ts_estado_negociacao = (min(enc.ts_estado_negociacao)))
  • Rows Removed by Join Filter: 10403
6. 31.550 44.062 ↓ 1.1 86,581 1

GroupAggregate (cost=0.42..5,420.03 rows=81,750 width=24) (actual time=0.047..44.062 rows=86,581 loops=1)

  • Group Key: enc.id_atendimento_cliente, enc.id_negociacao_cobranca
7. 12.512 12.512 ↓ 1.0 96,984 1

Index Only Scan using ix04_estado_nego_cobranca on estado_negociacao_cobranca enc (cost=0.42..3,875.16 rows=96,983 width=24) (actual time=0.042..12.512 rows=96,984 loops=1)

  • Heap Fetches: 2
8. 12.278 375.124 ↓ 96,984.0 96,984 1

Materialize (cost=20,927.03..20,927.03 rows=1 width=128) (actual time=337.011..375.124 rows=96,984 loops=1)

9. 91.774 362.846 ↓ 96,984.0 96,984 1

Sort (cost=20,927.03..20,927.03 rows=1 width=128) (actual time=337.007..362.846 rows=96,984 loops=1)

  • Sort Key: b.id_atendimento_cliente, b.id_negociacao_cobranca
  • Sort Method: external merge Disk: 12360kB
10. 66.433 271.072 ↓ 96,984.0 96,984 1

Hash Join (cost=15,017.46..20,927.02 rows=1 width=128) (actual time=162.437..271.072 rows=96,984 loops=1)

  • Hash Cond: ((enc2.id_atendimento_cliente = b.id_atendimento_cliente) AND (enc2.id_negociacao_cobranca = b.id_negociacao_cobranca))
11. 30.907 42.317 ↓ 1.0 96,984 1

Hash Join (cost=1.23..5,183.40 rows=96,983 width=64) (actual time=0.033..42.317 rows=96,984 loops=1)

  • Hash Cond: (enc2.id_estado_cobranca = ec.id_estado_cobranca)
12. 11.400 11.400 ↓ 1.0 96,984 1

Seq Scan on estado_negociacao_cobranca enc2 (cost=0.00..4,043.83 rows=96,983 width=48) (actual time=0.009..11.400 rows=96,984 loops=1)

13. 0.006 0.010 ↑ 1.0 10 1

Hash (cost=1.10..1.10 rows=10 width=24) (actual time=0.010..0.010 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.004 0.004 ↑ 1.0 10 1

Seq Scan on estado_cobranca ec (cost=0.00..1.10 rows=10 width=24) (actual time=0.002..0.004 rows=10 loops=1)

15. 28.351 162.322 ↓ 86,581.0 86,581 1

Hash (cost=15,016.22..15,016.22 rows=1 width=64) (actual time=162.322..162.322 rows=86,581 loops=1)

  • Buckets: 65536 (originally 1024) Batches: 4 (originally 1) Memory Usage: 3585kB
16. 15.908 133.971 ↓ 86,581.0 86,581 1

Gather (cost=9,149.39..15,016.22 rows=1 width=64) (actual time=65.528..133.971 rows=86,581 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
17. 23.037 118.063 ↓ 28,860.0 28,860 3

Hash Join (cost=8,149.39..14,016.12 rows=1 width=64) (actual time=79.065..118.063 rows=28,860 loops=3)

  • Hash Cond: ((enc2_1.id_atendimento_cliente = b.id_atendimento_cliente) AND (enc2_1.id_negociacao_cobranca = b.id_negociacao_cobranca) AND (enc2_1.ts_estado_negociacao = b.ts_maximo))
18. 11.640 16.679 ↑ 1.2 32,328 3

Hash Join (cost=1.23..3,953.63 rows=40,410 width=48) (actual time=0.182..16.679 rows=32,328 loops=3)

  • Hash Cond: (enc2_1.id_estado_cobranca = ec_1.id_estado_cobranca)
19. 5.004 5.004 ↑ 1.2 32,328 3

Parallel Seq Scan on estado_negociacao_cobranca enc2_1 (cost=0.00..3,478.10 rows=40,410 width=32) (actual time=0.014..5.004 rows=32,328 loops=3)

20. 0.014 0.035 ↑ 1.0 10 3

Hash (cost=1.10..1.10 rows=10 width=24) (actual time=0.035..0.035 rows=10 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
21. 0.021 0.021 ↑ 1.0 10 3

Seq Scan on estado_cobranca ec_1 (cost=0.00..1.10 rows=10 width=24) (actual time=0.018..0.021 rows=10 loops=3)

22. 23.103 78.347 ↓ 1.1 86,581 3

Hash (cost=6,237.53..6,237.53 rows=81,750 width=24) (actual time=78.347..78.347 rows=86,581 loops=3)

  • Buckets: 65536 Batches: 2 Memory Usage: 2872kB
23. 9.250 55.244 ↓ 1.1 86,581 3

Subquery Scan on b (cost=0.42..6,237.53 rows=81,750 width=24) (actual time=0.057..55.244 rows=86,581 loops=3)

24. 31.560 45.994 ↓ 1.1 86,581 3

GroupAggregate (cost=0.42..5,420.03 rows=81,750 width=24) (actual time=0.056..45.994 rows=86,581 loops=3)

  • Group Key: enc1.id_atendimento_cliente, enc1.id_negociacao_cobranca
25. 14.434 14.434 ↓ 1.0 96,984 3

Index Only Scan using ix04_estado_nego_cobranca on estado_negociacao_cobranca enc1 (cost=0.42..3,875.16 rows=96,983 width=24) (actual time=0.051..14.434 rows=96,984 loops=3)

  • Heap Fetches: 2
26. 86.581 86.581 ↑ 1.0 1 86,581

Index Scan using xif1negociacao_cobranca on negociacao_cobranca nc (cost=0.29..0.37 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=86,581)

  • Index Cond: (id_atendimento_cliente = enc2.id_atendimento_cliente)
  • Filter: (enc2.id_negociacao_cobranca = id_negociacao_cobranca)
27. 86.581 86.581 ↑ 1.0 1 86,581

Index Scan using ix03_atendimento_cliente on atendimento_cliente ac (cost=0.29..0.37 rows=1 width=34) (actual time=0.001..0.001 rows=1 loops=86,581)

  • Index Cond: (id_atendimento_cliente = enc.id_atendimento_cliente)
28. 86.581 86.581 ↑ 1.0 1 86,581

Index Scan using xpktipo_canal_atendimento on tipo_canal_atendimento tca (cost=0.14..0.15 rows=1 width=17) (actual time=0.001..0.001 rows=1 loops=86,581)

  • Index Cond: (id_tipo_canal_atendimento = ac.id_tipo_canal_atendimento)
29. 86.581 86.581 ↑ 1.0 1 86,581

Index Scan using xpkoperador_autoatendimento on operador_autoatendimento oaoper (cost=0.28..0.29 rows=1 width=29) (actual time=0.001..0.001 rows=1 loops=86,581)

  • Index Cond: (id_operador_autoatendimento = enc2.id_operador_autoatendimento)
30.          

SubPlan (forNested Loop)

31. 0.000 0.000 ↓ 0.0 0 86,581

Index Scan using xpkoperador_autoatendimento on operador_autoatendimento oasup (cost=0.28..8.29 rows=1 width=18) (actual time=0.000..0.000 rows=0 loops=86,581)

  • Index Cond: (id_operador_autoatendimento = enc2.id_supervisor_autoatendimento)