explain.depesz.com

PostgreSQL's explain analyze made readable

Result: k0BP : with new method and without join

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 292.978 ↑ 1.1 14 1

Finalize GroupAggregate (cost=56,267.39..56,278.52 rows=16 width=36) (actual time=284.061..292.978 rows=14 loops=1)

  • Group Key: ledger_entry.currency
2. 10.582 292.987 ↓ 1.1 36 1

Gather Merge (cost=56,267.39..56,278.08 rows=32 width=36) (actual time=284.032..292.987 rows=36 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 4.020 282.405 ↑ 1.3 12 3 / 3

Partial GroupAggregate (cost=55,267.36..55,274.36 rows=16 width=36) (actual time=277.627..282.405 rows=12 loops=3)

  • Group Key: ledger_entry.currency
4. 3.840 278.385 ↓ 31.7 10,773 3 / 3

Sort (cost=55,267.36..55,268.21 rows=340 width=10) (actual time=277.608..278.385 rows=10,773 loops=3)

  • Sort Key: ledger_entry.currency
  • Sort Method: quicksort Memory: 1,037kB
  • Worker 0: Sort Method: quicksort Memory: 800kB
  • Worker 1: Sort Method: quicksort Memory: 832kB
5. 148.499 274.545 ↓ 31.7 10,773 3 / 3

Hash Join (cost=121.14..55,253.07 rows=340 width=10) (actual time=0.643..274.545 rows=10,773 loops=3)

  • Hash Cond: (ledger_entry.account_id = billing_account.id)
6. 125.823 125.823 ↑ 1.3 892,745 3 / 3

Parallel Seq Scan on ledger_entry (cost=0.00..52,178.84 rows=1,124,884 width=18) (actual time=0.008..125.823 rows=892,745 loops=3)

7. 0.007 0.223 ↓ 1.2 17 3 / 3

Hash (cost=120.96..120.96 rows=14 width=8) (actual time=0.223..0.223 rows=17 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
8. 0.017 0.216 ↓ 1.2 17 3 / 3

Bitmap Heap Scan on billing_account (cost=70.19..120.96 rows=14 width=8) (actual time=0.208..0.216 rows=17 loops=3)

  • Recheck Cond: ((customer_id = 1) AND (account_group = 'CUSTOMER_PREPAID_FUNDS'::accountgroupenum))
  • Heap Blocks: exact=7
9. 0.011 0.199 ↓ 0.0 0 3 / 3

BitmapAnd (cost=70.19..70.19 rows=14 width=0) (actual time=0.199..0.199 rows=0 loops=3)

10. 0.030 0.030 ↓ 1.1 220 3 / 3

Bitmap Index Scan on billing_account_customer_id_idx (cost=0.00..5.86 rows=209 width=0) (actual time=0.030..0.030 rows=220 loops=3)

  • Index Cond: (customer_id = 1)
11. 0.158 0.158 ↑ 1.0 3,128 3 / 3

Bitmap Index Scan on billing_account_account_group_idx (cost=0.00..64.07 rows=3,171 width=0) (actual time=0.158..0.158 rows=3,128 loops=3)

  • Index Cond: (account_group = 'CUSTOMER_PREPAID_FUNDS'::accountgroupenum)
Planning time : 0.479 ms
Execution time : 293.425 ms