explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wsbB

Settings
# exclusive inclusive rows x rows loops node
1. 26.991 22,130.069 ↓ 5.0 1,001 1

GroupAggregate (cost=2,644,393.10..2,645,259.72 rows=200 width=40) (actual time=22,094.579..22,130.069 rows=1,001 loops=1)

  • Group Key: tr.user_id
2. 88.464 22,103.078 ↑ 1.0 86,412 1

Sort (cost=2,644,393.10..2,644,609.13 rows=86,412 width=68) (actual time=22,094.549..22,103.078 rows=86,412 loops=1)

  • Sort Key: tr.user_id
  • Sort Method: external merge Disk: 1936kB
3. 52.911 22,014.614 ↑ 1.0 86,412 1

Nested Loop Left Join (cost=30.44..2,633,762.27 rows=86,412 width=68) (actual time=0.034..22,014.614 rows=86,412 loops=1)

4. 13.055 13.055 ↑ 1.0 86,412 1

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

5. 86.412 21,948.648 ↑ 1.0 1 86,412

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

6. 3,715.716 21,862.236 ↑ 1.0 1 86,412

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

  • Sort Key: er.ts DESC NULLS LAST
  • Sort Method: top-N heapsort Memory: 25kB
7. 14,862.864 18,146.520 ↓ 367.0 367 86,412

Bitmap Heap Scan on exchange_rates er (cost=11.92..30.43 rows=1 width=40) (actual time=0.044..0.210 rows=367 loops=86,412)

  • Recheck Cond: (ts <= tr.ts)
  • Filter: (((to_currency)::text = 'GBP'::text) AND ((from_currency)::text = (tr.currency)::text))
  • Rows Removed by Filter: 368
  • Heap Blocks: exact=449087
8. 3,283.656 3,283.656 ↓ 1.5 735 86,412

Bitmap Index Scan on idx_es_ts (cost=0.00..11.92 rows=486 width=0) (actual time=0.038..0.038 rows=735 loops=86,412)

  • Index Cond: (ts <= tr.ts)
Planning time : 0.530 ms
Execution time : 22,131.041 ms