explain.depesz.com

PostgreSQL's explain analyze made readable

Result: oLp0

Settings
# exclusive inclusive rows x rows loops node
1. 0.214 11,656.198 ↓ 5.0 1,001 1

Sort (cost=421,856.05..421,856.55 rows=200 width=40) (actual time=11,656.138..11,656.198 rows=1,001 loops=1)

  • Sort Key: tr.user_id
  • Sort Method: quicksort Memory: 71kB
2. 73.767 11,655.984 ↓ 5.0 1,001 1

HashAggregate (cost=421,845.91..421,848.41 rows=200 width=40) (actual time=11,655.787..11,655.984 rows=1,001 loops=1)

  • Group Key: tr.user_id
3. 7.098 11,582.217 ↓ 1.7 85,530 1

Nested Loop Left Join (cost=8.31..421,467.62 rows=50,439 width=68) (actual time=0.048..11,582.217 rows=85,530 loops=1)

4. 28.569 28.569 ↓ 1.7 85,530 1

Seq Scan on transactions tr (cost=0.00..1,184.65 rows=50,439 width=60) (actual time=0.016..28.569 rows=85,530 loops=1)

  • Filter: (amount <> '0'::numeric)
  • Rows Removed by Filter: 882
5. 85.530 11,546.550 ↑ 1.0 1 85,530

Limit (cost=8.31..8.31 rows=1 width=40) (actual time=0.134..0.135 rows=1 loops=85,530)

6. 3,592.260 11,461.020 ↑ 1.0 1 85,530

Sort (cost=8.31..8.31 rows=1 width=40) (actual time=0.134..0.134 rows=1 loops=85,530)

  • Sort Key: er.ts DESC NULLS LAST
  • Sort Method: top-N heapsort Memory: 25kB
7. 7,868.760 7,868.760 ↓ 367.0 367 85,530

Index Only Scan using idx_ts_from_to on exchange_rates er (cost=0.28..8.30 rows=1 width=40) (actual time=0.012..0.092 rows=367 loops=85,530)

  • Index Cond: ((from_currency = (tr.currency)::text) AND (ts <= tr.ts))
  • Heap Fetches: 31415642
Planning time : 0.320 ms
Execution time : 11,656.277 ms