explain.depesz.com

PostgreSQL's explain analyze made readable

Result: D5af

Settings
# exclusive inclusive rows x rows loops node
1. 0.425 2,486.297 ↑ 17.0 4 1

GroupAggregate (cost=12,047.90..12,057.82 rows=68 width=44) (actual time=2,485.848..2,486.297 rows=4 loops=1)

  • Group Key: payments.currency, payments.action
2. 1.499 2,485.872 ↓ 4.2 3,696 1

Sort (cost=12,047.90..12,050.12 rows=890 width=20) (actual time=2,485.730..2,485.872 rows=3,696 loops=1)

  • Sort Key: payments.currency, payments.action
  • Sort Method: quicksort Memory: 385kB
3. 176.303 2,484.373 ↓ 4.2 3,696 1

Merge Join (cost=3,904.73..12,004.30 rows=890 width=20) (actual time=848.292..2,484.373 rows=3,696 loops=1)

  • Merge Cond: (payments.id = balance_transactions.reference_id)
4. 6.884 651.065 ↑ 1.2 4,172 1

Sort (cost=3,904.14..3,916.82 rows=5,071 width=20) (actual time=650.303..651.065 rows=4,172 loops=1)

  • Sort Key: payments.id
  • Sort Method: quicksort Memory: 518kB
5. 644.181 644.181 ↑ 1.2 4,172 1

Index Scan using index_payments_on_user_id on payments (cost=0.43..3,592.07 rows=5,071 width=20) (actual time=0.792..644.181 rows=4,172 loops=1)

  • Index Cond: (user_id = 540512)
6. 1,657.005 1,657.005 ↑ 1.1 2,513,378 1

Index Scan using index_balance_transactions_on_reference_type_and_reference_id on balance_transactions (cost=0.58..1,299,340.67 rows=2,691,218 width=16) (actual time=0.104..1,657.005 rows=2,513,378 loops=1)

  • Index Cond: ((reference_type)::text = 'Payment'::text)
Planning time : 0.610 ms
Execution time : 2,486.425 ms