explain.depesz.com

A tool for finding a real cause for slow queries.

Result: wS6

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

HashAggregate (cost=11553.11..11554.42 rows=131 width=274) (actual time=176.870..177.253 rows=560 loops=1)

2.          

CTE desembolso

3. 0.151 173.780 ↓ 4.3 560 1

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

4.          

CTE afiliados

5. 1.253 29.493 ↓ 4.2 536 1

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

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

CTE dados

7. 0.286 0.879 ↓ 4.1 536 1

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

8. 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)
9. 0.570 0.570 ↓ 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.029..0.570 rows=536 loops=1)

  • Index Cond: ((d.prefdep)::bpchar = (alvo.es_prefixo)::bpchar)
10. 0.398 2.581 ↓ 4.2 536 1

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

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

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

  • Filter: (es_razao_social IS NOT NULL)
12. 0.311 0.518 ↑ 1.0 587 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 42kB
13. 0.207 0.207 ↑ 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.007..0.207 rows=587 loops=1)

14. 16.677 25.659 ↑ 1.0 27248 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 1804kB
15. 8.982 8.982 ↑ 1.0 27248 1

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

16. 0.297 30.568 ↓ 4.2 536 1

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

17. 30.271 30.271 ↓ 4.2 536 1

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

18. 0.017 142.989 ↓ 24.0 24 1

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

19. 25.036 142.972 ↓ 24.0 24 1

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

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

Initplan (forHash Anti Join)

21. 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)

22. 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)

23. 0.028 0.117 ↓ 7.8 47 1

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

24. 0.040 0.040 ↑ 1.0 1 1

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

  • Index Cond: ((prefdep)::text = ($3)::text)
25. 0.049 0.049 ↓ 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.017..0.049 rows=47 loops=1)

  • Index Cond: ((afiliacao_cielo_mob_diretor.es_prefixo)::bpchar = (d.prefdep)::bpchar)
26. 64.424 117.813 ↑ 1.0 162476 1

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

  • Buckets: 16384 Batches: 2 Memory Usage: 3737kB
27. 53.389 53.389 ↑ 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.004..53.389 rows=162476 loops=1)

28. 0.002 0.072 ↓ 0.0 0 1

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

29. 0.000 0.070 ↓ 0.0 0 1

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

30.          

Initplan (forNested Loop Anti Join)

31. 0.002 0.005 ↑ 1.0 1 1

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

32. 0.003 0.003 ↑ 129.0 1 1

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

33. 0.005 0.069 ↓ 0.0 0 1

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

34. 0.052 0.052 ↑ 1.0 1 1

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

  • Index Cond: ((prefdep)::text = ($2)::text)
35. 0.012 0.012 ↓ 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.012..0.012 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))
36. 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)
37. 0.401 175.535 ↓ 4.3 560 1

Hash Left Join (cost=2.19..6.80 rows=131 width=274) (actual time=26.401..175.535 rows=560 loops=1)

  • Hash Cond: (((desembolso.prefdep)::bpchar = (desemb_giro_cart.es_prefixo)::bpchar) AND (desembolso.es_cnpj = desemb_giro_cart.es_cpf_cnpj))
38. 0.514 175.121 ↓ 4.3 560 1

Hash Left Join (cost=1.08..4.69 rows=131 width=265) (actual time=26.371..175.121 rows=560 loops=1)

  • Hash Cond: (((desembolso.prefdep)::bpchar = (desemb_acl.es_prefixo)::bpchar) AND (desembolso.es_cnpj = desemb_acl.es_cpf_cnpj))
39. 174.597 174.597 ↓ 4.3 560 1

CTE Scan on desembolso (cost=0.00..2.62 rows=131 width=256) (actual time=26.318..174.597 rows=560 loops=1)

40. 0.000 0.010 ↓ 0.0 0 1

Hash (cost=1.06..1.06 rows=1 width=29) (actual time=0.010..0.010 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 0kB
41. 0.010 0.010 ↓ 0.0 0 1

Seq Scan on afiliacao_cielo_diretor_desembolso desemb_acl (cost=0.00..1.06 rows=1 width=29) (actual time=0.010..0.010 rows=0 loops=1)

  • Filter: ((es_prd = '505'::text) AND (es_mdl = '1'::text))
42. 0.005 0.013 ↑ 1.0 4 1

Hash (cost=1.06..1.06 rows=4 width=29) (actual time=0.013..0.013 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
43. 0.008 0.008 ↑ 1.0 4 1

Seq Scan on afiliacao_cielo_diretor_desembolso desemb_giro_cart (cost=0.00..1.06 rows=4 width=29) (actual time=0.006..0.008 rows=4 loops=1)

  • Filter: ((es_prd = '505'::text) AND (es_mdl = '7'::text))