explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2Fwn : Optimization for: plan #rXsC

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 72.660 11,695.244 ↓ 5.0 1,001 1

HashAggregate (cost=722,955.32..722,957.82 rows=200 width=40) (actual time=11,695.082..11,695.244 rows=1,001 loops=1)

  • Group Key: tr.user_id
2. 32.166 11,622.584 ↑ 1.0 86,412 1

Nested Loop Left Join (cost=8.32..722,307.23 rows=86,412 width=68) (actual time=0.041..11,622.584 rows=86,412 loops=1)

3. 11.210 11.210 ↑ 1.0 86,412 1

Seq Scan on transactions tr (cost=0.00..1,415.12 rows=86,412 width=60) (actual time=0.005..11.210 rows=86,412 loops=1)

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

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

5. 3,542.892 11,492.796 ↑ 1.0 1 86,412

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

  • Sort Key: er.ts DESC NULLS LAST
  • Sort Method: top-N heapsort Memory: 25kB
6. 7,949.904 7,949.904 ↓ 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.092 rows=367 loops=86,412)

  • Index Cond: ((ts <= tr.ts) AND ((from_currency)::text = (tr.currency)::text))
Planning time : 0.414 ms
Execution time : 11,695.355 ms