explain.depesz.com

A tool for finding a real cause for slow queries.

Result: hmZ

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.146 240.673 ↓ 4.3 560 1

Append (cost=1379.71..11542.38 rows=131 width=253) (actual time=41.196..240.673 rows=560 loops=1)

2.          

CTE afiliados

3. 1.122 44.081 ↓ 4.2 536 1

Hash Left Join (cost=1343.55..1379.71 rows=129 width=184) (actual time=41.187..44.081 rows=536 loops=1)

  • Hash Cond: (((dados.prefdep)::bpchar = (mob.es_prefixo)::bpchar) AND (dados.es_cnpj = mob.es_cpf_cnpj))
4.          

CTE dados

5. 0.273 1.049 ↓ 4.1 536 1

Nested Loop Left Join (cost=0.00..241.67 rows=130 width=86) (actual time=0.258..1.049 rows=536 loops=1)

6. 0.023 0.023 ↑ 1.0 1 1

Index Scan using tbldependenciasbr_pkey on tbldependenciasbr d (cost=0.00..8.28 rows=1 width=5) (actual time=0.021..0.023 rows=1 loops=1)

  • Index Cond: ((prefdep)::text = '2890'::text)
7. 0.753 0.753 ↓ 4.1 536 1

Index Scan using afiliacao_cielo_mob_diretor_publico_alvo_pkey on afiliacao_cielo_mob_diretor_publico_alvo alvo (cost=0.00..231.77 rows=130 width=86) (actual time=0.232..0.753 rows=536 loops=1)

  • Index Cond: ((d.prefdep)::bpchar = (alvo.es_prefixo)::bpchar)
8. 0.361 2.678 ↓ 4.2 536 1

Hash Left Join (cost=24.68..31.16 rows=129 width=169) (actual time=0.866..2.678 rows=536 loops=1)

  • Hash Cond: (((dados.prefdep)::bpchar = (entra_sai.es_prefixo)::bpchar) AND (dados.es_cnpj = entra_sai.es_cpf_cnpj))
9. 1.732 1.732 ↓ 4.2 536 1

CTE Scan on dados (cost=0.00..2.60 rows=129 width=152) (actual time=0.262..1.732 rows=536 loops=1)

  • Filter: (es_razao_social IS NOT NULL)
10. 0.305 0.585 ↑ 1.0 587 1

Hash (cost=15.87..15.87 rows=587 width=40) (actual time=0.585..0.585 rows=587 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 42kB
11. 0.280 0.280 ↑ 1.0 587 1

Seq Scan on afiliacao_cielo_diretor_ent_sai entra_sai (cost=0.00..15.87 rows=587 width=40) (actual time=0.018..0.280 rows=587 loops=1)

12. 14.841 40.281 ↑ 1.0 27248 1

Hash (cost=668.48..668.48 rows=27248 width=35) (actual time=40.281..40.281 rows=27248 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 1804kB
13. 25.440 25.440 ↑ 1.0 27248 1

Seq Scan on afiliacao_cielo_mob_diretor mob (cost=0.00..668.48 rows=27248 width=35) (actual time=0.018..25.440 rows=27248 loops=1)

14. 0.294 45.107 ↓ 4.2 536 1

Subquery Scan on "*SELECT* 1" (cost=0.00..3.87 rows=129 width=256) (actual time=41.195..45.107 rows=536 loops=1)

15. 44.813 44.813 ↓ 4.2 536 1

CTE Scan on afiliados (cost=0.00..2.58 rows=129 width=256) (actual time=41.193..44.813 rows=536 loops=1)

16. 0.016 195.316 ↓ 24.0 24 1

Subquery Scan on "*SELECT* 2" (cost=6860.73..7682.26 rows=1 width=76) (actual time=172.754..195.316 rows=24 loops=1)

17. 22.943 195.300 ↓ 24.0 24 1

Hash Anti Join (cost=6860.73..7682.25 rows=1 width=76) (actual time=172.752..195.300 rows=24 loops=1)

  • Hash Cond: (afiliacao_cielo_mob_diretor.es_cpf_cnpj = esporadicos.afiliacao_cielo_mob_diretor_publico_alvo.es_cnpj)
18.          

Initplan (forHash Anti Join)

19. 0.002 0.003 ↑ 1.0 1 1

Limit (cost=0.00..0.02 rows=1 width=20) (actual time=0.003..0.003 rows=1 loops=1)

20. 0.001 0.001 ↑ 129.0 1 1

CTE Scan on afiliados (cost=0.00..2.58 rows=129 width=20) (actual time=0.001..0.001 rows=1 loops=1)

21. 0.026 0.127 ↓ 7.8 47 1

Nested Loop Left Join (cost=0.00..25.46 rows=6 width=76) (actual time=0.074..0.127 rows=47 loops=1)

22. 0.033 0.033 ↑ 1.0 1 1

Index Scan using tbldependenciasbr_pkey on tbldependenciasbr d (cost=0.00..8.28 rows=1 width=5) (actual time=0.032..0.033 rows=1 loops=1)

  • Index Cond: ((prefdep)::text = ($3)::text)
23. 0.068 0.068 ↓ 7.8 47 1

Index Scan using afiliacao_cielo_mob_diretor_pkey on afiliacao_cielo_mob_diretor (cost=0.00..17.11 rows=6 width=76) (actual time=0.039..0.068 rows=47 loops=1)

  • Index Cond: ((afiliacao_cielo_mob_diretor.es_prefixo)::bpchar = (d.prefdep)::bpchar)
24. 63.500 172.227 ↑ 1.0 162476 1

Hash (cost=4035.76..4035.76 rows=162476 width=15) (actual time=172.227..172.227 rows=162476 loops=1)

  • Buckets: 16384 Batches: 2 Memory Usage: 3737kB
25. 108.727 108.727 ↑ 1.0 162476 1

Seq Scan on afiliacao_cielo_mob_diretor_publico_alvo (cost=0.00..4035.76 rows=162476 width=15) (actual time=0.026..108.727 rows=162476 loops=1)

26. 0.002 0.104 ↓ 0.0 0 1

Subquery Scan on "*SELECT* 3" (cost=0.02..2476.54 rows=1 width=81) (actual time=0.104..0.104 rows=0 loops=1)

27. 0.000 0.102 ↓ 0.0 0 1

Nested Loop Anti Join (cost=0.02..2476.53 rows=1 width=81) (actual time=0.102..0.102 rows=0 loops=1)

28.          

Initplan (forNested Loop Anti Join)

29. 0.002 0.006 ↑ 1.0 1 1

Limit (cost=0.00..0.02 rows=1 width=20) (actual time=0.006..0.006 rows=1 loops=1)

30. 0.004 0.004 ↑ 129.0 1 1

CTE Scan on afiliados (cost=0.00..2.58 rows=129 width=20) (actual time=0.004..0.004 rows=1 loops=1)

31. 0.004 0.101 ↓ 0.0 0 1

Nested Loop (cost=0.00..20.59 rows=2 width=81) (actual time=0.101..0.101 rows=0 loops=1)

32. 0.045 0.045 ↑ 1.0 1 1

Index Scan using tbldependenciasbr_pkey on tbldependenciasbr d (cost=0.00..8.28 rows=1 width=5) (actual time=0.044..0.045 rows=1 loops=1)

  • Index Cond: ((prefdep)::text = ($2)::text)
33. 0.052 0.052 ↓ 0.0 0 1

Index Scan using afiliacao_cielo_diretor_ent_sai_es_prefixo_es_tipo_idx on afiliacao_cielo_diretor_ent_sai (cost=0.00..12.29 rows=2 width=81) (actual time=0.052..0.052 rows=0 loops=1)

  • Index Cond: (((afiliacao_cielo_diretor_ent_sai.es_prefixo)::bpchar = (d.prefdep)::bpchar) AND (afiliacao_cielo_diretor_ent_sai.es_status IS NOT NULL))
34. 0.000 0.000 ↓ 0.0 0

Index Scan using afiliacao_cielo_mob_diretor_publico_alvo_pkey on afiliacao_cielo_mob_diretor_publico_alvo (cost=0.00..1227.95 rows=1 width=15) (actual time=.. rows= loops=0)

  • Index Cond: (afiliacao_cielo_diretor_ent_sai.es_cpf_cnpj = esporadicos.afiliacao_cielo_mob_diretor_publico_alvo.es_cnpj)