explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RPSJ

Settings
# exclusive inclusive rows x rows loops node
1. 322,389.444 327,806.361 ↓ 8.6 105,632 1

GroupAggregate (cost=1,050.39..1,176.17 rows=12,272 width=663) (actual time=4,430.937..327,806.361 rows=105,632 loops=1)

  • Group Key: tb_core_customer_data.name, tb_core_customer_data.cpf_cnpj, tb_core_provider_registry.cd_person_type, tb_core_provider_registry.nm_provider, tb_core_provider_registry.dt_birth, tb_core_provider_registry.document_provider, tb_core_provider_registry.is_active, tb_core_customer_intermediate.cd_customer_origin
2. 4,365.632 5,416.917 ↓ 42.4 520,597 1

Sort (cost=1,050.39..1,053.45 rows=12,272 width=454) (actual time=4,427.521..5,416.917 rows=520,597 loops=1)

  • Sort Key: tb_core_customer_data.name, tb_core_customer_data.cpf_cnpj, tb_core_provider_registry.cd_person_type, tb_core_provider_registry.nm_provider, tb_core_provider_registry.dt_birth, tb_core_provider_registry.document_provider, tb_core_provider_registry.is_active, tb_core_customer_intermediate.cd_customer_origin
  • Sort Method: external merge Disk: 239848kB
3. 418.132 1,051.285 ↓ 42.4 520,597 1

Nested Loop (cost=12.10..967.04 rows=12,272 width=454) (actual time=11.591..1,051.285 rows=520,597 loops=1)

4. 94.601 112.556 ↓ 42.4 520,597 1

Hash Join (cost=12.07..229.56 rows=12,272 width=97) (actual time=11.577..112.556 rows=520,597 loops=1)

  • Hash Cond: (tb_products_fund_customer.id_fund = tb_products_fund_provider.id_fund)
5. 6.411 6.411 ↓ 1.0 45,466 1

Index Only Scan using tb_products_fund_customer_pk on tb_products_fund_customer (cost=0.04..188.21 rows=45,465 width=12) (actual time=0.025..6.411 rows=45,466 loops=1)

  • Index Cond: (id_contract = 21)
  • Heap Fetches: 35
6. 2.734 11.544 ↓ 46.1 9,411 1

Hash (cost=11.77..11.77 rows=204 width=101) (actual time=11.544..11.544 rows=9,411 loops=1)

  • Buckets: 16384 (originally 1024) Batches: 1 (originally 1) Memory Usage: 1438kB
7. 1.520 8.810 ↓ 46.1 9,411 1

Hash Join (cost=8.58..11.77 rows=204 width=101) (actual time=7.090..8.810 rows=9,411 loops=1)

  • Hash Cond: (tb_products_fund.id_fund = tb_products_fund_provider.id_fund)
8. 0.234 0.234 ↓ 1.0 844 1

Index Only Scan using tb_products_fund_pk on tb_products_fund (cost=0.03..2.70 rows=843 width=8) (actual time=0.026..0.234 rows=844 loops=1)

  • Index Cond: (id_contract = 21)
  • Heap Fetches: 343
9. 2.392 7.056 ↓ 46.1 9,411 1

Hash (cost=8.30..8.30 rows=204 width=97) (actual time=7.056..7.056 rows=9,411 loops=1)

  • Buckets: 16384 (originally 1024) Batches: 1 (originally 1) Memory Usage: 1401kB
10. 1.166 4.664 ↓ 46.1 9,411 1

Nested Loop (cost=0.78..8.30 rows=204 width=97) (actual time=0.127..4.664 rows=9,411 loops=1)

  • Join Filter: ((dm_core_provider_attribution.cd_attribution)::text = (tb_products_fund_provider.cd_attribution)::text)
11. 0.073 0.306 ↓ 1.1 57 1

Nested Loop (cost=0.75..3.44 rows=50 width=111) (actual time=0.098..0.306 rows=57 loops=1)

12. 0.027 0.176 ↓ 1.1 57 1

Hash Join (cost=0.74..2.15 rows=50 width=47) (actual time=0.088..0.176 rows=57 loops=1)

  • Hash Cond: ((tb_core_provider_registry_atribution.cd_attribution)::text = (dm_core_provider_attribution.cd_attribution)::text)
13. 0.030 0.109 ↓ 1.1 57 1

Merge Join (cost=0.03..1.43 rows=50 width=29) (actual time=0.037..0.109 rows=57 loops=1)

  • Merge Cond: (tb_core_customer_intermediate.id_provider = tb_core_provider_registry_atribution.id_provider)
14. 0.013 0.013 ↑ 1.0 36 1

Index Only Scan using tb_core_customer_intermediate_pk on tb_core_customer_intermediate (cost=0.01..0.48 rows=36 width=18) (actual time=0.010..0.013 rows=36 loops=1)

  • Index Cond: (id_contract = 21)
  • Heap Fetches: 0
15. 0.066 0.066 ↑ 1.0 260 1

Index Only Scan using tb_core_provider_registry_atribution_pk on tb_core_provider_registry_atribution (cost=0.01..0.87 rows=262 width=11) (actual time=0.023..0.066 rows=260 loops=1)

  • Index Cond: (id_contract = 21)
  • Heap Fetches: 104
16. 0.011 0.040 ↑ 1.0 31 1

Hash (cost=0.67..0.67 rows=31 width=22) (actual time=0.040..0.040 rows=31 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
17. 0.029 0.029 ↑ 1.0 31 1

Index Scan using dm_core_provider_attribution_pk on dm_core_provider_attribution (cost=0.01..0.67 rows=31 width=22) (actual time=0.010..0.029 rows=31 loops=1)

  • Index Cond: (id_contract = 21)
18. 0.057 0.057 ↑ 1.0 1 57

Index Scan using tb_core_provider_registry_pk on tb_core_provider_registry (cost=0.01..0.03 rows=1 width=72) (actual time=0.001..0.001 rows=1 loops=57)

  • Index Cond: ((id_contract = 21) AND (id_provider = tb_core_provider_registry_atribution.id_provider))
19. 3.192 3.192 ↓ 82.5 165 57

Index Only Scan using tb_products_fund_provider_pk on tb_products_fund_provider (cost=0.03..0.09 rows=2 width=15) (actual time=0.004..0.056 rows=165 loops=57)

  • Index Cond: ((id_contract = 21) AND (id_provider = tb_core_provider_registry_atribution.id_provider) AND (cd_attribution = (tb_core_provider_registry_atribution.cd_attribution)::text))
  • Heap Fetches: 44
20. 520.597 520.597 ↑ 1.0 1 520,597

Index Scan using tb_core_customer_data_pk on tb_core_customer_data (cost=0.03..0.06 rows=1 width=373) (actual time=0.001..0.001 rows=1 loops=520,597)

  • Index Cond: ((id_contract = 21) AND (id_customer = tb_products_fund_customer.id_customer))
Planning time : 57.172 ms
Execution time : 327,868.610 ms