explain.depesz.com

PostgreSQL's explain analyze made readable

Result: G4Au

Settings
# exclusive inclusive rows x rows loops node
1. 0.496 568.743 ↑ 1.0 1,000 1

Limit (cost=155,921.74..167,401.78 rows=1,000 width=231) (actual time=557.495..568.743 rows=1,000 loops=1)

2. 20.779 568.247 ↑ 1.7 11,000 1

Nested Loop Left Join (cost=41,121.33..260,355.66 rows=19,097 width=231) (actual time=313.595..568.247 rows=11,000 loops=1)

  • Join Filter: ((tb_dist_certificate_daily.id_contract = tb_dist_certificate_quote_erosion_executed.id_contract) AND (tb_dist_certificate_daily.dt_reference = tb_dist_certificate_quote_erosion_executed.dt_reference) AND (tb_dist_certificate_daily.id_customer = tb_dist_certificate_quote_erosion_executed.id_customer) AND (tb_dist_certificate_daily.id_instrument = tb_dist_certificate_quote_erosion_executed.id_instrument) AND (tb_dist_certificate_daily.id_certificate = tb_dist_certificate_quote_erosion_executed.id_certificate))
3. 6.417 503.468 ↑ 1.7 11,000 1

Nested Loop Left Join (cost=41,120.91..187,214.21 rows=19,097 width=204) (actual time=313.534..503.468 rows=11,000 loops=1)

4. 5.003 475.051 ↑ 1.7 11,000 1

Nested Loop Left Join (cost=41,120.62..171,330.06 rows=19,097 width=168) (actual time=313.510..475.051 rows=11,000 loops=1)

5. 54.737 459.048 ↑ 1.7 11,000 1

Hash Join (cost=41,120.34..157,145.40 rows=19,097 width=135) (actual time=313.485..459.048 rows=11,000 loops=1)

  • Hash Cond: ((tb_dist_certificate_daily.id_customer = tb_dist_certificate.id_customer) AND (tb_dist_certificate_daily.id_instrument = tb_dist_certificate.id_instrument) AND (tb_dist_certificate_daily.id_certificate = tb_dist_certificate.id_certificate))
6. 58.723 91.911 ↑ 2.2 143,786 1

Hash Join (cost=391.45..113,909.61 rows=318,336 width=101) (actual time=0.549..91.911 rows=143,786 loops=1)

  • Hash Cond: (tb_dist_certificate_daily.id_instrument = tb_dist_fund_daily.id_instrument)
7. 32.664 32.664 ↑ 1.7 143,786 1

Index Scan using tb_dist_certificate_daily_id_contract_dt_reference_idx on tb_dist_certificate_daily (cost=0.57..112,861.89 rows=248,285 width=82) (actual time=0.016..32.664 rows=143,786 loops=1)

  • Index Cond: ((id_contract = 8) AND (dt_reference = 20,200,603))
8. 0.131 0.524 ↑ 1.0 755 1

Hash (cost=381.19..381.19 rows=775 width=27) (actual time=0.523..0.524 rows=755 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 54kB
9. 0.393 0.393 ↑ 1.0 755 1

Index Scan using tb_dist_fund_daily_dt_reference_id_contract_id_instrument_idx on tb_dist_fund_daily (cost=0.42..381.19 rows=775 width=27) (actual time=0.016..0.393 rows=755 loops=1)

  • Index Cond: ((dt_reference = 20,200,603) AND (id_contract = 8))
10. 76.786 312.400 ↑ 1.0 249,545 1

Hash (cost=36,345.51..36,345.51 rows=250,479 width=46) (actual time=312.400..312.400 rows=249,545 loops=1)

  • Buckets: 262,144 Batches: 1 Memory Usage: 22,548kB
11. 235.614 235.614 ↑ 1.0 249,545 1

Seq Scan on tb_dist_certificate (cost=0.00..36,345.51 rows=250,479 width=46) (actual time=0.015..235.614 rows=249,545 loops=1)

  • Filter: ((NOT is_from_minicom) AND (id_contract = 8))
  • Rows Removed by Filter: 1,087,056
12. 11.000 11.000 ↑ 1.0 1 11,000

Index Scan using tb_dist_fund_selected_pk on tb_dist_fund_selected (cost=0.28..0.74 rows=1 width=45) (actual time=0.001..0.001 rows=1 loops=11,000)

  • Index Cond: ((tb_dist_certificate.id_contract = id_contract) AND (id_contract = 8) AND (tb_dist_certificate.id_instrument = id_instrument))
13. 22.000 22.000 ↑ 1.0 1 11,000

Index Scan using tb_core_customer_data_pk on tb_core_customer_data (cost=0.29..0.83 rows=1 width=44) (actual time=0.002..0.002 rows=1 loops=11,000)

  • Index Cond: ((tb_dist_certificate.id_contract = id_contract) AND (id_contract = 8) AND (tb_dist_certificate.id_customer = id_customer))
14. 0.000 0.000 ↓ 0.0 0 11,000

Materialize (cost=0.42..2.91 rows=2 width=26) (actual time=0.000..0.000 rows=0 loops=11,000)

15. 0.006 0.006 ↓ 0.0 0 1

Index Scan using tb_dist_certificate_quote_erosion_executed_idx1 on tb_dist_certificate_quote_erosion_executed (cost=0.42..2.90 rows=2 width=26) (actual time=0.006..0.006 rows=0 loops=1)

  • Index Cond: ((id_contract = 8) AND (dt_reference = 20,200,603))
16.          

SubPlan (for Nested Loop Left Join)

17. 11.000 44.000 ↑ 1.0 1 11,000

Nested Loop (cost=0.72..3.77 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=11,000)

18. 22.000 22.000 ↑ 1.0 1 11,000

Index Only Scan using tb_core_customer_broker_accounts_digit on tb_core_customer_broker_accounts (cost=0.44..1.47 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=11,000)

  • Index Cond: ((vl_account_number = (ceiling(((tb_dist_certificate.cd_account / 10))::double precision))::bigint) AND (vl_account_digit = ("right"(btrim(((tb_dist_certificate.cd_account)::character varying)::text), 1))::smallint) AND (id_customer = tb_core_customer_data.id_customer) AND (id_contract = tb_core_customer_data.id_contract))
  • Heap Fetches: 0
19. 11.000 11.000 ↑ 1.0 1 11,000

Index Scan using tb_core_broker_office_pk on tb_core_broker_office (cost=0.28..2.30 rows=1 width=12) (actual time=0.001..0.001 rows=1 loops=11,000)

  • Index Cond: ((id_contract = tb_core_customer_data.id_contract) AND (id_office = tb_core_customer_broker_accounts.id_office))