explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ngEh

Settings
# exclusive inclusive rows x rows loops node
1. 24.214 436.584 ↓ 113.0 113 1

Unique (cost=109.13..109.28 rows=1 width=611) (actual time=411.626..436.584 rows=113 loops=1)

2. 239.398 412.370 ↓ 6,532.0 6,532 1

Sort (cost=109.13..109.13 rows=1 width=611) (actual time=411.624..412.370 rows=6,532 loops=1)

  • Sort Key: tb_dist_fund_selected.id_instrument, tb_dist_fund_selected.id_manager, tb_dist_fund_selected.is_negotiable, tb_dist_fund_selected.nm_fund, tb_dist_fund_selected.ds_business, tb_dist_fund_selected.cnpj, tb_dist_fund_selected.id_calculation_form, tb_dist_fund_selected.vl_min_apli_ini, tb_dist_fund_selected.vl_min_apli_adc, tb_dist_fund_selected.vl_min_deposit, tb_dist_fund_selected.vl_min_withdraw, tb_dist_fund_selected.pz_conv_deposit, tb_dist_fund_selected.pz_liq_deposit, tb_dist_fund_selected.pz_conv_withdraw, tb_dist_fund_selected.pz_liq_withdraw, tb_dist_fund_selected.pz_conv_withdraw_wait, tb_dist_fund_selected.pz_liq_withdraw_wait, tb_dist_fund_selected.vl_tax_entry, tb_dist_fund_selected.vl_tax_exit, tb_dist_fund_selected.id_category, tb_dist_fund_selected.id_index, tb_dist_fund_selected.pz_conv_quote_erosion, tb_dist_fund_selected.pz_liq_quote_erosion, tb_dist_fund_selected.vl_tax_adm, tb_dist_fund_selected.vl_tax_performance, tb_dist_fund_selected.hh_end_work, tb_dist_fund_selected.hh_end_work_fund, tb_dist_fund_selected.is_quote_erosion, tb_dist_fund_selected.id_group, tb_dist_fund_selected.is_fund_qualified, tb_dist_fund_selected.nm_fund_nickname, tb_dist_fund_selected.id_dist_class, tb_dist_fund_selected.id_dist_sub_class, tb_dist_fund_selected.is_fund_risk, tb_dist_fund_selected.is_active, tb_dist_fund_selected.risk_level, tb_dist_fund_selected.is_continuous_days, tb_dist_fund_selected.is_visible_for_advisor, tb_dist_fund_selected.days_before_pl_adm, tb_dist_fund_selected.is_rule_fee_adm_active, tb_dist_fund_selected.adm_fee_type, tb_dist_fund_selected.is_visible_for_carteirista, tb_dist_fund_selected.is_visible_for_not_carteirista, tb_dist_fund_selected.vl_tax_adm_rebate, tb_dist_fund_selected.is_from_minicom, tb_dist_fund_selected.is_gross_up, tb_dist_fund_selected.id_target_group, tb_dist_fund_selected.id_distribution, tb_dist_fund_selected.is_isento_pf, tb_dist_fund_selected.is_isento_pj, ((tb_dist_fund_document_246.id_contract IS NOT NULL)), ((tb_dist_fund_document_293.id_contract IS NOT NULL)), ((tb_dist_fund_document_1.id_contract IS NOT NULL)), (COALESCE(tb_dist_fund_selected_restriction_customer.is_restricted, false)), tb_dist_sub_class.nm_dist_sub_class, tb_dist_class.nm_dist_class, tb_dist_parameters.id_withdraw_rule, tb_dist_parameters.hh_max_internal_application, tb_dist_parameters.email_warning
  • Sort Method: quicksort Memory: 7,341kB
3. 10.265 172.972 ↓ 6,532.0 6,532 1

Nested Loop Anti Join (cost=2.67..109.12 rows=1 width=611) (actual time=0.667..172.972 rows=6,532 loops=1)

4. 9.329 136.579 ↓ 6,532.0 6,532 1

Nested Loop Left Join (cost=2.38..101.65 rows=1 width=620) (actual time=0.652..136.579 rows=6,532 loops=1)

  • Filter: ((whitelist.id_instrument IS NULL) OR (whitelist.id_office = ANY ('{-1,354}'::bigint[])))
  • Rows Removed by Filter: 29,660
5. 15.065 94.278 ↓ 8,243.0 8,243 1

Nested Loop (cost=2.10..98.82 rows=1 width=620) (actual time=0.640..94.278 rows=8,243 loops=1)

6. 9.579 70.970 ↓ 8,243.0 8,243 1

Nested Loop Anti Join (cost=2.10..97.80 rows=1 width=572) (actual time=0.632..70.970 rows=8,243 loops=1)

7. 5.843 53.148 ↓ 8,243.0 8,243 1

Nested Loop Left Join (cost=1.96..97.43 rows=1 width=571) (actual time=0.625..53.148 rows=8,243 loops=1)

8. 0.613 38.450 ↓ 385.0 385 1

Nested Loop Left Join (cost=1.68..92.31 rows=1 width=567) (actual time=0.616..38.450 rows=385 loops=1)

9. 0.376 30.237 ↓ 380.0 380 1

Nested Loop Left Join (cost=1.40..87.30 rows=1 width=563) (actual time=0.551..30.237 rows=380 loops=1)

10. 0.929 27.251 ↓ 174.0 174 1

Nested Loop (cost=1.11..82.28 rows=1 width=559) (actual time=0.533..27.251 rows=174 loops=1)

  • Join Filter: ((tb_dist_fund_selected.id_dist_class = tb_dist_sub_class.id_dist_class) AND (tb_dist_fund_selected.id_dist_sub_class = tb_dist_sub_class.id_dist_sub_class))
  • Rows Removed by Join Filter: 5,344
11. 0.034 0.034 ↓ 31.0 31 1

Seq Scan on tb_dist_sub_class (cost=0.00..1.35 rows=1 width=44) (actual time=0.013..0.034 rows=31 loops=1)

  • Filter: (id_contract = 8)
12. 4.422 26.288 ↓ 22.2 178 31

Hash Join (cost=1.11..80.81 rows=8 width=515) (actual time=0.012..0.848 rows=178 loops=31)

  • Hash Cond: (tb_dist_fund_selected.id_dist_class = tb_dist_class.id_dist_class)
13. 21.855 21.855 ↓ 1.9 255 31

Seq Scan on tb_dist_fund_selected (cost=0.00..79.25 rows=137 width=475) (actual time=0.010..0.705 rows=255 loops=31)

  • Filter: ((cnpj IS NOT NULL) AND is_active AND is_negotiable AND (is_visible_for_not_carteirista OR (NOT is_visible_for_carteirista)) AND (NOT is_visible_for_advisor) AND (id_contract = 8))
  • Rows Removed by Filter: 648
14. 0.004 0.011 ↓ 9.0 9 1

Hash (cost=1.10..1.10 rows=1 width=40) (actual time=0.011..0.011 rows=9 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
15. 0.007 0.007 ↓ 9.0 9 1

Seq Scan on tb_dist_class (cost=0.00..1.10 rows=1 width=40) (actual time=0.005..0.007 rows=9 loops=1)

  • Filter: (id_contract = 8)
16. 2.610 2.610 ↑ 1.0 2 174

Index Scan using tb_dist_fund_document_pk on tb_dist_fund_document tb_dist_fund_document_246 (cost=0.28..5.00 rows=2 width=8) (actual time=0.006..0.015 rows=2 loops=174)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_contract = 8) AND (id_instrument = tb_dist_fund_selected.id_instrument))
  • Filter: (id_document_type = 246)
  • Rows Removed by Filter: 14
17. 7.600 7.600 ↓ 0.0 0 380

Index Scan using tb_dist_fund_document_pk on tb_dist_fund_document tb_dist_fund_document_293 (cost=0.28..5.00 rows=1 width=8) (actual time=0.013..0.020 rows=0 loops=380)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_contract = 8) AND (id_instrument = tb_dist_fund_selected.id_instrument))
  • Filter: (id_document_type = 293)
  • Rows Removed by Filter: 24
18. 8.855 8.855 ↓ 1.8 21 385

Index Scan using tb_dist_fund_document_pk on tb_dist_fund_document tb_dist_fund_document_1 (cost=0.28..5.00 rows=12 width=8) (actual time=0.004..0.023 rows=21 loops=385)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_contract = 8) AND (id_instrument = tb_dist_fund_selected.id_instrument))
  • Filter: (id_document_type = 1)
  • Rows Removed by Filter: 4
19. 8.243 8.243 ↓ 0.0 0 8,243

Index Scan using tb_dist_fund_selected_restriction_customer_pk on tb_dist_fund_selected_restriction_customer (cost=0.14..0.25 rows=1 width=9) (actual time=0.001..0.001 rows=0 loops=8,243)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_contract = 8) AND (id_instrument = tb_dist_fund_selected.id_instrument) AND (id_customer = 93,211))
  • Filter: (is_restricted IS TRUE)
20. 8.243 8.243 ↑ 1.0 1 8,243

Seq Scan on tb_dist_parameters (cost=0.00..1.01 rows=1 width=48) (actual time=0.000..0.001 rows=1 loops=8,243)

  • Filter: (id_contract = 8)
21. 32.972 32.972 ↑ 2.2 4 8,243

Index Scan using tb_dist_fund_selected_offices_whitelist_pk on tb_dist_fund_selected_offices_whitelist whitelist (cost=0.28..2.72 rows=9 width=24) (actual time=0.002..0.004 rows=4 loops=8,243)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_contract = 8) AND (id_instrument = tb_dist_fund_selected.id_instrument))
  • Filter: is_active
  • Rows Removed by Filter: 0
22. 26.128 26.128 ↓ 0.0 0 6,532

Index Scan using tb_dist_fund_selected_offices_blacklist_pk on tb_dist_fund_selected_offices_blacklist blacklist (cost=0.29..3.87 rows=1 width=16) (actual time=0.004..0.004 rows=0 loops=6,532)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_contract = 8) AND (id_instrument = tb_dist_fund_selected.id_instrument) AND (id_office = ANY ('{-1,354}'::bigint[])))
  • Filter: is_active
Planning time : 9.497 ms
Execution time : 436.832 ms