explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Kvap

Settings
# exclusive inclusive rows x rows loops node
1. 3.789 792.529 ↓ 1,000.0 1,000 1

Limit (cost=243,820.93..243,831.68 rows=1 width=231) (actual time=785.259..792.529 rows=1,000 loops=1)

2. 168.618 788.740 ↓ 4.7 91,000 1

Hash Join (cost=34,712.11..243,820.93 rows=19,437 width=231) (actual time=140.985..788.740 rows=91,000 loops=1)

  • Hash Cond: (tb_dist_certificate_daily.id_instrument = tb_dist_fund_daily.id_instrument)
3. 25.867 255.506 ↓ 6.1 91,000 1

Nested Loop Left Join (cost=34,311.25..150,620.28 rows=15,015 width=191) (actual time=140.308..255.506 rows=91,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))
4. 38.328 229.639 ↓ 6.1 91,000 1

Hash Left Join (cost=34,310.83..150,242.46 rows=15,015 width=193) (actual time=140.291..229.639 rows=91,000 loops=1)

  • Hash Cond: ((tb_dist_certificate.id_contract = tb_dist_fund_selected.id_contract) AND (tb_dist_certificate.id_instrument = tb_dist_fund_selected.id_instrument))
5. 0.000 190.739 ↓ 6.1 91,000 1

Gather (cost=34,226.69..150,079.30 rows=15,015 width=160) (actual time=139.703..190.739 rows=91,000 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 17.004 217.932 ↓ 4.9 30,500 3 / 3

Parallel Hash Left Join (cost=33,226.69..147,577.80 rows=6,256 width=160) (actual time=136.174..217.932 rows=30,500 loops=3)

  • Hash Cond: ((tb_dist_certificate.id_contract = tb_core_customer_data.id_contract) AND (tb_dist_certificate.id_customer = tb_core_customer_data.id_customer))
7. 44.282 182.094 ↓ 4.9 30,500 3 / 3

Parallel Hash Join (cost=28,424.07..142,742.35 rows=6,256 width=120) (actual time=116.818..182.094 rows=30,500 loops=3)

  • 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))
8. 21.561 21.561 ↑ 1.4 74,603 3 / 3

Parallel Index Scan using tb_dist_certificate_daily_id_contract_dt_reference_idx on tb_dist_certificate_daily (cost=0.57..113,488.33 rows=105,462 width=82) (actual time=0.046..21.561 rows=74,603 loops=3)

  • Index Cond: ((id_contract = 8) AND (dt_reference = 20,200,601))
9. 35.150 116.251 ↑ 1.3 83,182 3 / 3

Parallel Hash (cost=26,599.46..26,599.46 rows=104,231 width=46) (actual time=116.251..116.251 rows=83,182 loops=3)

  • Buckets: 262,144 Batches: 1 Memory Usage: 23,488kB
10. 81.101 81.101 ↑ 1.3 83,182 3 / 3

Parallel Seq Scan on tb_dist_certificate (cost=0.00..26,599.46 rows=104,231 width=46) (actual time=0.010..81.101 rows=83,182 loops=3)

  • Filter: ((NOT is_from_minicom) AND (id_contract = 8))
  • Rows Removed by Filter: 362,352
11. 10.284 18.834 ↑ 1.3 30,883 3 / 3

Parallel Hash (cost=4,223.55..4,223.55 rows=38,604 width=44) (actual time=18.834..18.834 rows=30,883 loops=3)

  • Buckets: 131,072 Batches: 1 Memory Usage: 8,832kB
12. 8.550 8.550 ↑ 1.3 30,883 3 / 3

Parallel Seq Scan on tb_core_customer_data (cost=0.00..4,223.55 rows=38,604 width=44) (actual time=0.006..8.550 rows=30,883 loops=3)

  • Filter: (id_contract = 8)
13. 0.171 0.572 ↑ 1.0 987 1

Hash (cost=69.34..69.34 rows=987 width=45) (actual time=0.571..0.572 rows=987 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 84kB
14. 0.401 0.401 ↑ 1.0 987 1

Seq Scan on tb_dist_fund_selected (cost=0.00..69.34 rows=987 width=45) (actual time=0.009..0.401 rows=987 loops=1)

  • Filter: (id_contract = 8)
15. 0.000 0.000 ↓ 0.0 0 91,000

Materialize (cost=0.42..2.45 rows=1 width=26) (actual time=0.000..0.000 rows=0 loops=91,000)

16. 0.011 0.011 ↓ 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.44 rows=1 width=26) (actual time=0.011..0.011 rows=0 loops=1)

  • Index Cond: ((id_contract = 8) AND (dt_reference = 20,200,601))
17. 0.123 0.616 ↑ 1.1 752 1

Hash (cost=390.95..390.95 rows=793 width=27) (actual time=0.615..0.616 rows=752 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 53kB
18. 0.493 0.493 ↑ 1.1 752 1

Index Scan using tb_dist_fund_daily_dt_reference_id_contract_id_instrument_idx on tb_dist_fund_daily (cost=0.42..390.95 rows=793 width=27) (actual time=0.020..0.493 rows=752 loops=1)

  • Index Cond: ((dt_reference = 20,200,601) AND (id_contract = 8))
19.          

SubPlan (for Hash Join)

20. 91.000 364.000 ↑ 1.0 1 91,000

Nested Loop (cost=0.70..4.76 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=91,000)

21. 182.000 182.000 ↑ 1.0 1 91,000

Index Scan using tb_core_customer_broker_accounts_pk on tb_core_customer_broker_accounts (cost=0.42..2.46 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=91,000)

  • Index Cond: ((id_contract = tb_core_customer_data.id_contract) AND (id_customer = tb_core_customer_data.id_customer))
  • Filter: (((tb_dist_certificate.cd_account)::character varying)::text = (((vl_account_number)::text || ''::text) || (vl_account_digit)::text))
  • Rows Removed by Filter: 0
22. 91.000 91.000 ↑ 1.0 1 91,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=91,000)

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