explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dQCc

Settings
# exclusive inclusive rows x rows loops node
1. 171.086 2,922.633 ↓ 228.0 456 1

Unique (cost=41.51..41.82 rows=2 width=615) (actual time=2,746.386..2,922.633 rows=456 loops=1)

2. 2,040.416 2,751.547 ↓ 21,043.0 42,086 1

Sort (cost=41.51..41.52 rows=2 width=615) (actual time=2,746.375..2,751.547 rows=42,086 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_contract, 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, ((SubPlan 1))
  • Sort Method: quicksort Memory: 43,219kB
3. 71.835 711.131 ↓ 21,043.0 42,086 1

Nested Loop Left Join (cost=2.98..41.50 rows=2 width=615) (actual time=2.432..711.131 rows=42,086 loops=1)

4. 22.557 183.081 ↓ 11,785.0 11,785 1

Nested Loop Left Join (cost=2.70..39.58 rows=1 width=620) (actual time=2.235..183.081 rows=11,785 loops=1)

5. 17.103 113.384 ↓ 11,785.0 11,785 1

Nested Loop Left Join (cost=2.42..38.38 rows=1 width=620) (actual time=2.161..113.384 rows=11,785 loops=1)

6. 8.916 84.496 ↓ 11,785.0 11,785 1

Nested Loop Left Join (cost=2.28..38.17 rows=1 width=619) (actual time=2.127..84.496 rows=11,785 loops=1)

7. 1.063 58.398 ↓ 781.0 781 1

Nested Loop (cost=1.99..36.65 rows=1 width=615) (actual time=2.107..58.398 rows=781 loops=1)

8. 1.308 55.769 ↓ 783.0 783 1

Nested Loop Left Join (cost=1.86..36.48 rows=1 width=575) (actual time=2.077..55.769 rows=783 loops=1)

9. 0.981 38.228 ↓ 773.0 773 1

Nested Loop Left Join (cost=1.58..35.07 rows=1 width=571) (actual time=1.379..38.228 rows=773 loops=1)

10. 0.443 31.763 ↓ 457.0 457 1

Nested Loop (cost=1.30..33.66 rows=1 width=567) (actual time=1.319..31.763 rows=457 loops=1)

11. 0.106 0.196 ↓ 31.0 31 1

Hash Join (cost=1.02..2.39 rows=1 width=92) (actual time=0.095..0.196 rows=31 loops=1)

  • Hash Cond: (tb_dist_sub_class.id_contract = tb_dist_parameters.id_contract)
12. 0.058 0.058 ↓ 1.1 31 1

Seq Scan on tb_dist_sub_class (cost=0.00..1.28 rows=28 width=44) (actual time=0.038..0.058 rows=31 loops=1)

13. 0.005 0.032 ↑ 1.0 1 1

Hash (cost=1.01..1.01 rows=1 width=48) (actual time=0.032..0.032 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
14. 0.027 0.027 ↑ 1.0 1 1

Seq Scan on tb_dist_parameters (cost=0.00..1.01 rows=1 width=48) (actual time=0.026..0.027 rows=1 loops=1)

15. 31.124 31.124 ↓ 5.0 15 31

Index Scan using tb_dist_fund_selected_pk on tb_dist_fund_selected (cost=0.28..31.24 rows=3 width=475) (actual time=0.325..1.004 rows=15 loops=31)

  • Index Cond: (id_contract = tb_dist_sub_class.id_contract)
  • Filter: ((tb_dist_sub_class.id_dist_class = id_dist_class) AND (tb_dist_sub_class.id_dist_sub_class = id_dist_sub_class))
  • Rows Removed by Filter: 887
16. 5.484 5.484 ↑ 2.0 1 457

Index Scan using tb_dist_fund_document_pk on tb_dist_fund_document tb_dist_fund_document_246 (cost=0.28..1.40 rows=2 width=8) (actual time=0.006..0.012 rows=1 loops=457)

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

Index Scan using tb_dist_fund_document_pk on tb_dist_fund_document tb_dist_fund_document_293 (cost=0.28..1.40 rows=1 width=8) (actual time=0.015..0.021 rows=0 loops=773)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_instrument = tb_dist_fund_selected.id_instrument))
  • Filter: (id_document_type = 293)
  • Rows Removed by Filter: 17
18. 1.566 1.566 ↑ 1.0 1 783

Index Scan using tb_dist_class_pk on tb_dist_class (cost=0.13..0.17 rows=1 width=40) (actual time=0.002..0.002 rows=1 loops=783)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_dist_class = tb_dist_fund_selected.id_dist_class))
19. 17.182 17.182 ↓ 1.2 15 781

Index Scan using tb_dist_fund_document_pk on tb_dist_fund_document tb_dist_fund_document_1 (cost=0.28..1.40 rows=12 width=8) (actual time=0.004..0.022 rows=15 loops=781)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_instrument = tb_dist_fund_selected.id_instrument))
  • Filter: (id_document_type = 1)
  • Rows Removed by Filter: 3
20. 11.785 11.785 ↓ 0.0 0 11,785

Index Scan using tb_dist_fund_selected_restriction_customer_pk on tb_dist_fund_selected_restriction_customer (cost=0.14..0.18 rows=1 width=9) (actual time=0.001..0.001 rows=0 loops=11,785)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_instrument = tb_dist_fund_selected.id_instrument) AND (id_customer = 93,211))
  • Filter: (is_restricted IS TRUE)
21. 47.140 47.140 ↓ 0.0 0 11,785

Index Scan using tb_dist_fund_selected_offices_blacklist_pk on tb_dist_fund_selected_offices_blacklist blacklist (cost=0.29..1.19 rows=1 width=16) (actual time=0.004..0.004 rows=0 loops=11,785)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_instrument = tb_dist_fund_selected.id_instrument) AND (id_office = ANY ('{-1,354}'::bigint[])))
  • Filter: is_active
22. 35.355 35.355 ↑ 3.0 3 11,785

Index Scan using tb_dist_fund_selected_offices_whitelist_pk on tb_dist_fund_selected_offices_whitelist whitelist (cost=0.28..0.83 rows=9 width=16) (actual time=0.002..0.003 rows=3 loops=11,785)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_instrument = tb_dist_fund_selected.id_instrument))
  • Filter: is_active
  • Rows Removed by Filter: 0
23.          

SubPlan (for Nested Loop Left Join)

24. 0.000 420.860 ↑ 1.0 1 42,086

Limit (cost=0.42..0.50 rows=1 width=4) (actual time=0.010..0.010 rows=1 loops=42,086)

25. 420.860 420.860 ↑ 591.0 1 42,086

Index Only Scan Backward using tb_dist_fund_daily_pk on tb_dist_fund_daily daily (cost=0.42..45.74 rows=591 width=4) (actual time=0.010..0.010 rows=1 loops=42,086)

  • Index Cond: ((id_contract = tb_dist_fund_selected.id_contract) AND (id_instrument = tb_dist_fund_selected.id_instrument))
  • Heap Fetches: 39,296
Planning time : 19.102 ms
Execution time : 2,927.999 ms