explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9yLU

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.004 79.935 ↑ 1.0 10 1

Limit (cost=52.53..591.53 rows=10 width=67) (actual time=79.920..79.935 rows=10 loops=1)

2. 1.025 79.931 ↑ 3,432.5 10 1

WindowAgg (cost=52.53..1,850,188.03 rows=34,325 width=67) (actual time=79.918..79.931 rows=10 loops=1)

3. 1.285 78.906 ↑ 25.0 1,373 1

Nested Loop Left Join (cost=52.53..1,849,758.97 rows=34,325 width=59) (actual time=0.108..78.906 rows=1,373 loops=1)

4. 1.673 59.772 ↑ 25.0 1,373 1

Nested Loop Left Join (cost=52.23..74,151.43 rows=34,325 width=43) (actual time=0.083..59.772 rows=1,373 loops=1)

5. 4.552 4.552 ↑ 1.0 1,373 1

Seq Scan on users (cost=0.00..1,060.76 rows=1,373 width=27) (actual time=0.015..4.552 rows=1,373 loops=1)

  • Filter: ((tenant_id)::text = 'skirtsports'::text)
  • Rows Removed by Filter: 20448
6. 19.222 53.547 ↑ 25.0 1 1,373

HashAggregate (cost=52.23..52.73 rows=25 width=56) (actual time=0.039..0.039 rows=1 loops=1,373)

  • Group Key: t.user_id, t.value_type, t.currency
7. 34.325 34.325 ↑ 1.1 23 1,373

Index Scan using transactions_user_id on transactions t (cost=0.29..51.67 rows=25 width=54) (actual time=0.003..0.025 rows=23 loops=1,373)

  • Index Cond: (user_id = users.id)
  • Filter: (value_type = 'points'::transaction_value_type)
  • Rows Removed by Filter: 0
8. 0.000 17.849 ↓ 0.0 0 1,373

GroupAggregate (cost=0.29..51.71 rows=1 width=20) (actual time=0.013..0.013 rows=0 loops=1,373)

  • Group Key: t_1.user_id
9. 17.849 17.849 ↓ 0.0 0 1,373

Index Scan using transactions_user_id on transactions t_1 (cost=0.29..51.67 rows=1 width=18) (actual time=0.013..0.013 rows=0 loops=1,373)

  • Index Cond: (user_id = users.id)
  • Filter: (currency = 'EUR'::text)
  • Rows Removed by Filter: 23