explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 39V6

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 1,644.879 ↓ 1.6 8 1

Limit (cost=36,309.21..36,309.22 rows=5 width=293) (actual time=1,644.878..1,644.879 rows=8 loops=1)

2. 0.019 1,644.877 ↓ 1.6 8 1

Sort (cost=36,309.21..36,309.22 rows=5 width=293) (actual time=1,644.877..1,644.877 rows=8 loops=1)

  • Sort Key: tb_operation.id_operation DESC, tb_operation_bonds.seq
  • Sort Method: quicksort Memory: 29kB
3. 0.014 1,644.858 ↓ 1.6 8 1

Nested Loop Left Join (cost=178.92..36,309.21 rows=5 width=293) (actual time=1,644.775..1,644.858 rows=8 loops=1)

4. 0.013 1,644.812 ↓ 1.6 8 1

Nested Loop Left Join (cost=178.89..36,296.92 rows=5 width=271) (actual time=1,644.759..1,644.812 rows=8 loops=1)

5. 0.007 1,644.799 ↓ 1.6 8 1

Nested Loop Left Join (cost=178.86..36,284.63 rows=5 width=210) (actual time=1,644.752..1,644.799 rows=8 loops=1)

6. 0.188 1,644.768 ↓ 1.6 8 1

Nested Loop (cost=178.83..36,272.35 rows=5 width=149) (actual time=1,644.730..1,644.768 rows=8 loops=1)

  • Join Filter: (tb_operation_bonds.id_instrument = tb_instrument_bonds.id_instrument)
  • Rows Removed by Join Filter: 2000
7. 0.028 0.028 ↑ 1.0 251 1

Seq Scan on tb_instrument_bonds (cost=0.00..1.35 rows=251 width=12) (actual time=0.002..0.028 rows=251 loops=1)

8. 0.057 1,644.552 ↓ 1.6 8 251

Materialize (cost=178.83..36,269.11 rows=5 width=153) (actual time=6.442..6.552 rows=8 loops=251)

9. 0.025 1,644.495 ↓ 1.6 8 1

Nested Loop (cost=178.83..36,269.11 rows=5 width=153) (actual time=1,616.859..1,644.495 rows=8 loops=1)

10. 0.179 1,644.414 ↓ 1.6 8 1

Hash Join (cost=178.79..36,265.99 rows=5 width=117) (actual time=1,616.832..1,644.414 rows=8 loops=1)

  • Hash Cond: ((tb_operation.id_broker = tb_operation_bonds.id_broker) AND (tb_operation.id_operation = tb_operation_bonds.id_operation))
11. 1,624.461 1,624.461 ↑ 156.4 7 1

Seq Scan on tb_operation (cost=0.00..36,083.91 rows=1,095 width=67) (actual time=1,596.892..1,624.461 rows=7 loops=1)

  • Filter: ((id_investor = 121322) OR (id_office = 121322))
  • Rows Removed by Filter: 10480640
12. 10.611 19.774 ↓ 1.0 43,958 1

Hash (cost=112.91..112.91 rows=43,915 width=60) (actual time=19.774..19.774 rows=43,958 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 5166kB
13. 9.163 9.163 ↓ 1.0 43,958 1

Seq Scan on tb_operation_bonds (cost=0.00..112.91 rows=43,915 width=60) (actual time=0.005..9.163 rows=43,958 loops=1)

14. 0.056 0.056 ↑ 1.0 1 8

Index Scan using tb_instrument_pk on tb_instrument (cost=0.04..0.62 rows=1 width=36) (actual time=0.007..0.007 rows=1 loops=8)

  • Index Cond: (id_instrument = tb_operation_bonds.id_instrument)
15. 0.024 0.024 ↑ 1.0 1 8

Index Scan using tb_investor_pk on tb_investor tb_investor_assessor (cost=0.03..2.46 rows=1 width=65) (actual time=0.003..0.003 rows=1 loops=8)

  • Index Cond: (id_investor = tb_operation.id_office)
16. 0.000 0.000 ↓ 0.0 0 8

Index Scan using tb_investor_pk on tb_investor tb_investor_operator (cost=0.03..2.46 rows=1 width=65) (actual time=0.000..0.000 rows=0 loops=8)

  • Index Cond: (id_investor = tb_operation.id_operator)
17. 0.032 0.032 ↑ 1.0 1 8

Index Scan using tb_investor_pk on tb_investor (cost=0.03..2.46 rows=1 width=30) (actual time=0.004..0.004 rows=1 loops=8)

  • Index Cond: (id_investor = tb_operation.id_investor)
Planning time : 3.759 ms
Execution time : 1,645.043 ms