explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3wk4

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 114,976.710 ↓ 0.0 0 1

Nested Loop (cost=91,705.50..9,030,569.98 rows=31,441,681 width=37) (actual time=114,976.710..114,976.710 rows=0 loops=1)

2. 0.037 0.037 ↑ 1.0 1 1

Index Scan using tb_asset_operation_strategies_pk on tb_asset_operation_strategies (cost=0.28..8.30 rows=1 width=13) (actual time=0.034..0.037 rows=1 loops=1)

  • Index Cond: (id_strategy = 6,036)
  • Filter: (id_asset = 97)
3. 19.245 114,976.670 ↓ 0.0 0 1

Hash Join (cost=91,705.22..8,716,144.86 rows=31,441,681 width=32) (actual time=114,976.670..114,976.670 rows=0 loops=1)

  • Hash Cond: (tb_asset_operation.id_instrument = tb_instrument.id_instrument)
4. 114,143.435 114,151.460 ↓ 0.0 0 1

Seq Scan on tb_asset_operation (cost=34,059.24..8,137,272.24 rows=31,441,681 width=27) (actual time=114,151.460..114,151.460 rows=0 loops=1)

  • Filter: ((cd_operation_type = ANY ('{TRA,AJU}'::bpchar[])) AND (id_asset = 97) AND (id_strategy = 6,036) AND (cd_operation_state = 'A'::bpchar) AND ((hashed SubPlan 1) OR (hashed SubPlan 2)))
  • Rows Removed by Filter: 158,073,064
5.          

SubPlan (for Seq Scan)

6. 0.052 0.500 ↑ 1.0 23 1

Nested Loop (cost=0.42..195.41 rows=23 width=8) (actual time=0.085..0.500 rows=23 loops=1)

7. 0.011 0.011 ↑ 1.0 23 1

Seq Scan on tb_stock_etf_info (cost=0.00..1.23 rows=23 width=4) (actual time=0.007..0.011 rows=23 loops=1)

8. 0.437 0.437 ↑ 1.0 1 23

Index Scan using tb_stock_crypto_id_stock_idx on tb_stock (cost=0.42..8.44 rows=1 width=12) (actual time=0.019..0.019 rows=1 loops=23)

  • Index Cond: (id_stock = tb_stock_etf_info.id_stock)
9. 0.530 7.525 ↑ 618.6 567 1

Nested Loop (cost=2,387.83..32,986.96 rows=350,725 width=8) (actual time=3.828..7.525 rows=567 loops=1)

10. 0.193 3.871 ↑ 1.0 284 1

HashAggregate (cost=2,387.41..2,390.32 rows=291 width=4) (actual time=3.793..3.871 rows=284 loops=1)

  • Group Key: tb_stock_1_1.id_company
11. 0.235 3.678 ↑ 1.0 291 1

Nested Loop (cost=0.42..2,386.68 rows=291 width=4) (actual time=0.053..3.678 rows=291 loops=1)

12. 0.242 0.242 ↑ 1.0 291 1

Seq Scan on tb_stock_fii (cost=0.00..33.91 rows=291 width=4) (actual time=0.023..0.242 rows=291 loops=1)

13. 3.201 3.201 ↑ 1.0 1 291

Index Scan using tb_stock_crypto_id_stock_idx on tb_stock tb_stock_1_1 (cost=0.42..8.09 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=291)

  • Index Cond: (id_stock = tb_stock_fii.id_stock)
14. 3.124 3.124 ↑ 173.5 2 284

Index Scan using tb_stock_crypto_idx08 on tb_stock tb_stock_1 (cost=0.42..101.67 rows=347 width=12) (actual time=0.006..0.011 rows=2 loops=284)

  • Index Cond: (id_company = tb_stock_1_1.id_company)
15. 419.640 805.965 ↑ 1.0 1,505,809 1

Hash (cost=29,998.10..29,998.10 rows=1,505,910 width=21) (actual time=805.965..805.965 rows=1,505,809 loops=1)

  • Buckets: 1,048,576 Batches: 4 Memory Usage: 28,892kB
16. 386.325 386.325 ↑ 1.0 1,505,809 1

Seq Scan on tb_instrument (cost=0.00..29,998.10 rows=1,505,910 width=21) (actual time=0.015..386.325 rows=1,505,809 loops=1)