explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NjL9 : primitive, no TCE

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↑ 1.0 1,001 1

GroupAggregate (cost=3,184,357.48..3,185,234.11 rows=1,001 width=36) (actual rows=1,001 loops=1)

  • Group Key: t.user_id
2. 0.000 0.000 ↑ 1.0 86,412 1

Sort (cost=3,184,357.48..3,184,573.51 rows=86,412 width=12) (actual rows=86,412 loops=1)

  • Sort Key: t.user_id
  • Sort Method: external merge Disk: 1960kB
3. 0.000 0.000 ↑ 1.0 86,412 1

Nested Loop Left Join (cost=36.73..3,177,272.15 rows=86,412 width=12) (actual rows=86,412 loops=1)

4. 0.000 0.000 ↑ 1.0 86,412 1

Seq Scan on transactions t (cost=0.00..1,415.12 rows=86,412 width=20) (actual rows=86,412 loops=1)

5. 0.000 0.000 ↑ 1.0 1 86,412

Limit (cost=36.73..36.73 rows=1 width=16) (actual rows=1 loops=86,412)

6. 0.000 0.000 ↑ 243.0 1 86,412

Sort (cost=36.73..37.34 rows=243 width=16) (actual rows=1 loops=86,412)

  • Sort Key: exchange_rates.ts DESC
  • Sort Method: top-N heapsort Memory: 25kB
7. 0.000 0.000 ↓ 1.5 367 86,412

Seq Scan on exchange_rates (cost=0.00..35.52 rows=243 width=16) (actual rows=367 loops=86,412)

  • Filter: ((ts <= t.ts) AND ((t.currency)::text = (from_currency)::text) AND ((to_currency)::text = 'GBP'::text))
  • Rows Removed by Filter: 1091
Planning time : 0.150 ms
Execution time : 13,561.382 ms