explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1lbo

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 3,700.881 ↓ 1.7 17 1

Finalize GroupAggregate (cost=55,559.74..55,565.90 rows=10 width=36) (actual time=3,700.364..3,700.881 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,425
2. 0.526 3,700.928 ↑ 1.2 17 1

Gather Merge (cost=55,559.74..55,565.62 rows=20 width=36) (actual time=3,700.351..3,700.928 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,425
3. 0.393 3,700.402 ↓ 1.7 17 1

Partial GroupAggregate (cost=54,559.72..54,563.29 rows=10 width=36) (actual time=3,699.904..3,700.402 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,425
4. 0.484 3,700.009 ↓ 3.6 1,241 1

Sort (cost=54,559.72..54,560.58 rows=345 width=10) (actual time=3,699.888..3,700.009 rows=1,241 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Sort Key: billing_account.currency
  • Sort Method: quicksort Memory: 107kB
  • Buffers: shared hit=40,425
5. 1,927.805 3,699.525 ↓ 3.6 1,241 1

Hash Join (cost=120.40..54,545.17 rows=345 width=10) (actual time=3,578.795..3,699.525 rows=1,241 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,425
6. 1,771.514 1,771.514 ↓ 2.4 2,644,700 1

Parallel Seq Scan on public.ledger_entry (cost=0.00..51,509.55 rows=1,110,455 width=14) (actual time=0.004..1,771.514 rows=2,644,700 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,405
7. 0.006 0.206 ↓ 1.2 17 1

Hash (cost=120.22..120.22 rows=14 width=12) (actual time=0.206..0.206 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.014 0.200 ↓ 1.2 17 1

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

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

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

  • Buffers: shared hit=16
10. 0.020 0.020 ↑ 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.020..0.020 rows=204 loops=1)

  • Index Cond: (billing_account.customer_id = 671)
  • Buffers: shared hit=4
11. 0.163 0.163 ↓ 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.163..0.163 rows=3,128 loops=1)

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