explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YfuX

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=79.56..3,472,859.79 rows=200 width=36) (actual rows= loops=)

  • Group Key: tr.user_id
2.          

CTE _

3. 0.000 0.000 ↓ 0.0

Append (cost=0.00..39.16 rows=1,458 width=104) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Seq Scan on exchange_rates (cost=0.00..24.57 rows=1,457 width=72) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2 (cost=0.00..0.02 rows=1 width=104) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.01 rows=1 width=76) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Nested Loop (cost=40.40..3,472,170.03 rows=86,412 width=68) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Index Scan using idx_user_id on transactions tr (cost=0.29..4,456.47 rows=86,412 width=60) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Limit (cost=40.11..40.11 rows=1 width=104) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Sort (cost=40.11..40.11 rows=1 width=104) (actual rows= loops=)

  • Sort Key: er.ts DESC
11. 0.000 0.000 ↓ 0.0

CTE Scan on _ er (cost=0.00..40.10 rows=1 width=104) (actual rows= loops=)

  • Filter: ((ts <= tr.ts) AND ((from_currency)::text = (tr.currency)::text) AND ((to_currency)::text = 'GBP'::text))