explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xvRM : Optimization for: Optimization for: plan #rXsC; plan #2Fwn

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 71.409 10,755.394 ↓ 5.0 1,001 1

HashAggregate (cost=722,091.20..722,093.70 rows=200 width=40) (actual time=10,755.215..10,755.394 rows=1,001 loops=1)

  • Group Key: tr.user_id
2. 44.532 10,683.985 ↑ 1.0 86,412 1

Nested Loop Left Join (cost=8.31..721,443.11 rows=86,412 width=68) (actual time=0.031..10,683.985 rows=86,412 loops=1)

3. 10.777 10.777 ↑ 1.0 86,412 1

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

4. 0.000 10,628.676 ↑ 1.0 1 86,412

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

5. 3,715.716 10,628.676 ↑ 1.0 1 86,412

Sort (cost=8.31..8.31 rows=1 width=40) (actual time=0.122..0.123 rows=1 loops=86,412)

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

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

  • Index Cond: (((from_currency)::text = (tr.currency)::text) AND (ts <= tr.ts))
Planning time : 0.331 ms
Execution time : 10,755.456 ms