explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Akc3I : teste 2

Settings
# exclusive inclusive rows x rows loops node
1. 1,057.577 152,698.088 ↑ 1.0 1,001 1

GroupAggregate (cost=8,500.45..3,183,721.90 rows=1,001 width=36) (actual time=456.605..152,698.088 rows=1,001 loops=1)

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

Sort (cost=8,500.45..8,716.48 rows=86,412 width=20) (actual time=400.361..595.831 rows=86,412 loops=1)

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

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

4.          

SubPlan (forGroupAggregate)

5. 1,382.560 151,044.680 ↑ 1.0 1 86,410

Limit (cost=36.73..36.73 rows=1 width=12) (actual time=1.739..1.748 rows=1 loops=86,410)

6. 61,696.740 149,662.120 ↑ 243.0 1 86,410

Sort (cost=36.73..37.34 rows=243 width=12) (actual time=1.731..1.732 rows=1 loops=86,410)

  • Sort Key: e.ts DESC
  • Sort Method: top-N heapsort Memory: 25kB
7. 87,965.380 87,965.380 ↓ 1.5 367 86,410

Seq Scan on exchange_rates e (cost=0.00..35.52 rows=243 width=12) (actual time=0.009..1.018 rows=367 loops=86,410)

  • Filter: ((ts <= t.ts) AND ((from_currency)::text = (t.currency)::text) AND ((to_currency)::text = 'GBP'::text))
  • Rows Removed by Filter: 1091