explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uOvI

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 2,204.669 ↓ 1.7 17 1

Finalize GroupAggregate (cost=55,546.27..55,552.43 rows=10 width=36) (actual time=2,204.155..2,204.669 rows=17 loops=1)

  • Output: sum(CASE WHEN ledger_entry.is_credit THEN ('-1'::numeric * ledger_entry.value) ELSE ledger_entry.value END), billing_account.currency
  • Group Key: billing_account.currency
  • Buffers: shared hit=40,415
2. 0.524 2,204.727 ↑ 1.2 17 1

Gather Merge (cost=55,546.27..55,552.16 rows=20 width=36) (actual time=2,204.144..2,204.727 rows=17 loops=1)

  • Output: billing_account.currency, (PARTIAL sum(CASE WHEN ledger_entry.is_credit THEN ('-1'::numeric * ledger_entry.value) ELSE ledger_entry.value END))
  • Workers Planned: 2
  • Workers Launched: 0
  • Buffers: shared hit=40,415
3. 0.391 2,204.203 ↓ 1.7 17 1

Partial GroupAggregate (cost=54,546.25..54,549.83 rows=10 width=36) (actual time=2,203.708..2,204.203 rows=17 loops=1)

  • Output: billing_account.currency, PARTIAL sum(CASE WHEN ledger_entry.is_credit THEN ('-1'::numeric * ledger_entry.value) ELSE ledger_entry.value END)
  • Group Key: billing_account.currency
  • Buffers: shared hit=40,415
4. 0.464 2,203.812 ↓ 3.6 1,228 1

Sort (cost=54,546.25..54,547.11 rows=345 width=10) (actual time=2,203.692..2,203.812 rows=1,228 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Sort Key: billing_account.currency
  • Sort Method: quicksort Memory: 106kB
  • Buffers: shared hit=40,415
5. 1,134.621 2,203.348 ↓ 3.6 1,228 1

Hash Join (cost=120.40..54,531.71 rows=345 width=10) (actual time=2,154.946..2,203.348 rows=1,228 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Inner Unique: true
  • Hash Cond: (ledger_entry.account_id = billing_account.id)
  • Buffers: shared hit=40,415
6. 1,068.509 1,068.509 ↓ 2.4 2,644,334 1

Parallel Seq Scan on public.ledger_entry (cost=0.00..51,496.81 rows=1,110,181 width=14) (actual time=0.005..1,068.509 rows=2,644,334 loops=1)

  • Output: ledger_entry.id, ledger_entry.posted_date, ledger_entry.journal_id, ledger_entry.account_id, ledger_entry.value, ledger_entry.is_credit, ledger_entry.description, ledger_entry.invoice_id, ledger_entry.currency, ledger_entry.product_id, ledger_entry.corrected, ledger_entry.correction_for_ledger_entry_id, ledger_entry.customer_rebate_id
  • Buffers: shared hit=40,395
7. 0.007 0.218 ↓ 1.2 17 1

Hash (cost=120.22..120.22 rows=14 width=12) (actual time=0.217..0.218 rows=17 loops=1)

  • Output: billing_account.currency, billing_account.id
  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=20
8. 0.015 0.211 ↓ 1.2 17 1

Bitmap Heap Scan on public.billing_account (cost=69.52..120.22 rows=14 width=12) (actual time=0.203..0.211 rows=17 loops=1)

  • Output: billing_account.currency, billing_account.id
  • Recheck Cond: ((billing_account.customer_id = 673) AND (billing_account.account_group = 'CUSTOMER_PREPAID_FUNDS'::accountgroupenum))
  • Heap Blocks: exact=4
  • Buffers: shared hit=20
9. 0.003 0.196 ↓ 0.0 0 1

BitmapAnd (cost=69.52..69.52 rows=14 width=0) (actual time=0.196..0.196 rows=0 loops=1)

  • Buffers: shared hit=16
10. 0.021 0.021 ↑ 1.0 204 1

Bitmap Index Scan on billing_account_customer_id_idx (cost=0.00..5.82 rows=204 width=0) (actual time=0.021..0.021 rows=204 loops=1)

  • Index Cond: (billing_account.customer_id = 673)
  • Buffers: shared hit=4
11. 0.172 0.172 ↓ 1.0 3,128 1

Bitmap Index Scan on billing_account_account_group_idx (cost=0.00..63.44 rows=3,087 width=0) (actual time=0.172..0.172 rows=3,128 loops=1)

  • Index Cond: (billing_account.account_group = 'CUSTOMER_PREPAID_FUNDS'::accountgroupenum)
  • Buffers: shared hit=12