explain.depesz.com

PostgreSQL's explain analyze made readable

Result: q8PW

Settings
# exclusive inclusive rows x rows loops node
1. 2,249.427 15,086.067 ↑ 1.0 538,082 1

Hash Left Join (cost=33,317.39..7,089,677.90 rows=538,082 width=532) (actual time=502.543..15,086.067 rows=538,082 loops=1)

  • Hash Cond: (tb_stock.id_instrument = tb_instrument.id_instrument)
2. 197.240 1,037.674 ↑ 1.0 538,082 1

Hash Left Join (cost=97.92..49,400.69 rows=538,082 width=271) (actual time=0.889..1,037.674 rows=538,082 loops=1)

  • Hash Cond: (tb_stock.id_company = tb_market_sector_company.id_company)
  • Join Filter: (tb_stock.cd_segment <> '9999'::bpchar)
3. 192.704 840.216 ↑ 1.0 538,082 1

Hash Left Join (cost=70.20..44,558.17 rows=538,082 width=263) (actual time=0.661..840.216 rows=538,082 loops=1)

  • Hash Cond: (tb_stock.cd_segment = tb_market_segment.cd_segment)
4. 512.744 647.503 ↑ 1.0 538,082 1

Hash Left Join (cost=68.82..37,158.16 rows=538,082 width=232) (actual time=0.634..647.503 rows=538,082 loops=1)

  • Hash Cond: (tb_stock.id_company = tb_company.id_company)
  • Join Filter: (tb_stock.cd_segment <> '9999'::bpchar)
5. 134.147 134.147 ↑ 1.0 538,082 1

Seq Scan on tb_stock (cost=0.00..35,675.03 rows=538,082 width=202) (actual time=0.009..134.147 rows=538,082 loops=1)

  • Filter: (id_exchange = 1)
6. 0.297 0.612 ↑ 1.0 1,992 1

Hash (cost=43.92..43.92 rows=1,992 width=34) (actual time=0.612..0.612 rows=1,992 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 137kB
7. 0.315 0.315 ↑ 1.0 1,992 1

Seq Scan on tb_company (cost=0.00..43.92 rows=1,992 width=34) (actual time=0.004..0.315 rows=1,992 loops=1)

8. 0.003 0.009 ↑ 1.0 17 1

Hash (cost=1.17..1.17 rows=17 width=36) (actual time=0.009..0.009 rows=17 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
9. 0.006 0.006 ↑ 1.0 17 1

Seq Scan on tb_market_segment (cost=0.00..1.17 rows=17 width=36) (actual time=0.003..0.006 rows=17 loops=1)

10. 0.123 0.218 ↑ 1.0 965 1

Hash (cost=15.65..15.65 rows=965 width=12) (actual time=0.218..0.218 rows=965 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 50kB
11. 0.095 0.095 ↑ 1.0 965 1

Seq Scan on tb_market_sector_company (cost=0.00..15.65 rows=965 width=12) (actual time=0.004..0.095 rows=965 loops=1)

12. 357.421 499.244 ↑ 1.0 1,012,821 1

Hash (cost=20,559.21..20,559.21 rows=1,012,821 width=24) (actual time=499.244..499.244 rows=1,012,821 loops=1)

  • Buckets: 1,048,576 (originally 1048576) Batches: 2 (originally 1) Memory Usage: 57,345kB
13. 141.823 141.823 ↑ 1.0 1,012,821 1

Seq Scan on tb_instrument (cost=0.00..20,559.21 rows=1,012,821 width=24) (actual time=0.011..141.823 rows=1,012,821 loops=1)

14.          

SubPlan (for Hash Left Join)

15. 0.000 4,842.738 ↓ 0.0 0 538,082

Limit (cost=2.45..5.91 rows=1 width=12) (actual time=0.009..0.009 rows=0 loops=538,082)

16.          

Initplan (for Limit)

17. 538.082 1,076.164 ↑ 1.0 1 538,082

Limit (cost=0.00..2.02 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=538,082)

18. 538.082 538.082 ↑ 1.0 1 538,082

Index Scan using idx_tb_stock_cd_stock on tb_stock tb2 (cost=0.00..2.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=538,082)

  • Index Cond: ((cd_stock)::text = btrim((tb_stock.cd_stock_option)::text))
  • Rows Removed by Index Recheck: 0
19. 3,766.574 3,766.574 ↓ 0.0 0 538,082

Index Scan Backward using tb_daily_indicators_temp_pk on tb_daily_indicators (cost=0.43..2,009.16 rows=581 width=12) (actual time=0.007..0.007 rows=0 loops=538,082)

  • Index Cond: (id_stock = $1)
  • Filter: (id_point <= fc_current_trade_day())
20. 538.082 4,304.656 ↓ 0.0 0 538,082

Limit (cost=2.45..5.91 rows=1 width=12) (actual time=0.008..0.008 rows=0 loops=538,082)

21.          

Initplan (for Limit)

22. 0.000 538.082 ↑ 1.0 1 538,082

Limit (cost=0.00..2.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=538,082)

23. 538.082 538.082 ↑ 1.0 1 538,082

Index Scan using idx_tb_stock_cd_stock on tb_stock tb2_1 (cost=0.00..2.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=538,082)

  • Index Cond: ((cd_stock)::text = btrim((tb_stock.cd_stock_option)::text))
  • Rows Removed by Index Recheck: 0
24. 3,228.492 3,228.492 ↓ 0.0 0 538,082

Index Scan Backward using tb_daily_indicators_temp_pk on tb_daily_indicators tb_daily_indicators_1 (cost=0.43..2,009.16 rows=581 width=12) (actual time=0.006..0.006 rows=0 loops=538,082)

  • Index Cond: (id_stock = $3)
  • Filter: (id_point <= fc_current_trade_day())
25. 0.000 2,152.328 ↑ 1.0 1 538,082

Limit (cost=0.44..1.17 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=538,082)

26. 2,152.328 2,152.328 ↑ 153.0 1 538,082

Index Scan Backward using tb_stock_bdi_pk on tb_stock_bdi (cost=0.44..113.27 rows=153 width=8) (actual time=0.004..0.004 rows=1 loops=538,082)

  • Index Cond: (id_stock = tb_stock.id_stock)