explain.depesz.com

PostgreSQL's explain analyze made readable

Result: My5y

Settings
# exclusive inclusive rows x rows loops node
1. 1.285 66,713.920 ↑ 17.0 4 1

GroupAggregate (cost=12,047.90..12,057.82 rows=68 width=44) (actual time=66,712.528..66,713.920 rows=4 loops=1)

  • Group Key: payments.currency, payments.action
2. 9.529 66,712.635 ↓ 4.2 3,696 1

Sort (cost=12,047.90..12,050.13 rows=890 width=20) (actual time=66,712.200..66,712.635 rows=3,696 loops=1)

  • Sort Key: payments.currency, payments.action
  • Sort Method: quicksort Memory: 385kB
3. 681.174 66,703.106 ↓ 4.2 3,696 1

Merge Join (cost=3,904.73..12,004.30 rows=890 width=20) (actual time=12,781.911..66,703.106 rows=3,696 loops=1)

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

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

  • Sort Key: payments.id
  • Sort Method: quicksort Memory: 518kB
5. 11.587 11.587 ↑ 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=1.038..11.587 rows=4,172 loops=1)

  • Index Cond: (user_id = 540512)
6. 66,003.838 66,003.838 ↑ 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,356.56 rows=2,691,250 width=16) (actual time=0.811..66,003.838 rows=2,513,378 loops=1)

  • Index Cond: ((reference_type)::text = 'Payment'::text)