explain.depesz.com

A tool for finding a real cause for slow queries.

Result: Cdq

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

HashAggregate (cost=11554.42..11555.73 rows=131 width=274) (actual time=483.836..484.209 rows=560 loops=1)

2.          

CTE desembolso

3. 0.152 480.064 ↓ 4.3 560 1

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

4.          

CTE afiliados

5. 1.190 46.248 ↓ 4.2 536 1

Hash Left Join (cost=1343.55..1379.71 rows=129 width=184) (actual time=42.945..46.248 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.291 1.287 ↓ 4.1 536 1

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

8. 0.022 0.022 ↑ 1.0 1 1

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

  • Index Cond: ((prefdep)::text = '2890'::text)
9. 0.974 0.974 ↓ 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.244..0.974 rows=536 loops=1)

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

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

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

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

  • Filter: (es_razao_social IS NOT NULL)
12. 0.323 1.060 ↑ 1.0 587 1

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

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

14. 14.920 41.548 ↑ 1.0 27248 1

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

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

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

16. 0.304 47.309 ↓ 4.2 536 1

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

17. 47.005 47.005 ↓ 4.2 536 1

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

18. 0.017 432.478 ↓ 24.0 24 1

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

19. 22.147 432.461 ↓ 24.0 24 1

Hash Anti Join (cost=6860.73..7682.25 rows=1 width=76) (actual time=410.692..432.461 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.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)

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

23. 0.026 0.118 ↓ 7.8 47 1

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

24. 0.026 0.026 ↑ 1.0 1 1

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

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

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

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

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

28. 0.001 0.125 ↓ 0.0 0 1

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

29. 0.000 0.124 ↓ 0.0 0 1

Nested Loop Anti Join (cost=0.02..2476.53 rows=1 width=81) (actual time=0.124..0.124 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.004 0.122 ↓ 0.0 0 1

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

34. 0.084 0.084 ↑ 1.0 1 1

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

  • Index Cond: ((prefdep)::text = ($2)::text)
35. 0.034 0.034 ↓ 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.034..0.034 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.765 482.642 ↓ 4.3 560 1

Hash Left Join (cost=2.19..8.11 rows=131 width=274) (actual time=43.036..482.642 rows=560 loops=1)

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

Hash Left Join (cost=1.08..5.34 rows=131 width=265) (actual time=43.006..481.863 rows=560 loops=1)

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

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

40. 0.001 0.009 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 0kB
41. 0.008 0.008 ↓ 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.008..0.008 rows=0 loops=1)

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
43. 0.006 0.006 ↑ 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.004..0.006 rows=4 loops=1)

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