explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rXsC

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 53.623 12,093.640 ↓ 5.0 1,001 1

GroupAggregate (cost=8.73..726,379.30 rows=200 width=40) (actual time=5.405..12,093.640 rows=1,001 loops=1)

  • Group Key: tr.user_id
2. 33.799 12,040.017 ↑ 1.0 86,412 1

Nested Loop Left Join (cost=8.73..725,728.71 rows=86,412 width=68) (actual time=0.102..12,040.017 rows=86,412 loops=1)

3. 81.362 81.362 ↑ 1.0 86,412 1

Index Scan using idx_user_amount on transactions tr (cost=0.42..4,836.60 rows=86,412 width=60) (actual time=0.034..81.362 rows=86,412 loops=1)

4. 86.412 11,924.856 ↑ 1.0 1 86,412

Limit (cost=8.32..8.32 rows=1 width=40) (actual time=0.138..0.138 rows=1 loops=86,412)

5. 3,715.716 11,838.444 ↑ 1.0 1 86,412

Sort (cost=8.32..8.32 rows=1 width=40) (actual time=0.137..0.137 rows=1 loops=86,412)

  • Sort Key: er.ts DESC NULLS LAST
  • Sort Method: top-N heapsort Memory: 25kB
6. 8,122.728 8,122.728 ↓ 367.0 367 86,412

Index Scan using idx_ts_from_to on exchange_rates er (cost=0.28..8.31 rows=1 width=40) (actual time=0.012..0.094 rows=367 loops=86,412)

  • Index Cond: ((ts <= tr.ts) AND ((from_currency)::text = (tr.currency)::text))