explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ojd

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↑ 11.4 74 1

Partial GroupAggregate (cost=28,775.64..28,798.85 rows=844 width=61) (actual rows=74 loops=1)

  • Output: customer.id, ledger_entry.currency, billing_account.account_group, customer.name, PARTIAL sum(CASE WHEN ledger_entry.is_credit THEN ledger_entry.value ELSE ('-1'::numeric * ledger_entry.value) END)
  • Group Key: customer.id, ledger_entry.currency, billing_account.account_group
  • Buffers: shared hit=7,959
2. 0.000 0.000 ↓ 2.3 1,961 1

Sort (cost=28,775.64..28,777.75 rows=844 width=35) (actual rows=1,961 loops=1)

  • Output: customer.id, ledger_entry.currency, billing_account.account_group, customer.name, ledger_entry.is_credit, ledger_entry.value
  • Sort Key: customer.id, ledger_entry.currency, billing_account.account_group
  • Sort Method: quicksort Memory: 207kB
  • Buffers: shared hit=7,959
3. 0.000 0.000 ↓ 2.3 1,961 1

Hash Join (cost=562.38..28,734.61 rows=844 width=35) (actual rows=1,961 loops=1)

  • Output: customer.id, ledger_entry.currency, billing_account.account_group, customer.name, ledger_entry.is_credit, ledger_entry.value
  • Inner Unique: true
  • Hash Cond: (billing_account.customer_id = customer.id)
  • Buffers: shared hit=7,947
4. 0.000 0.000 ↓ 2.3 1,961 1

Hash Join (cost=555.90..28,725.86 rows=844 width=22) (actual rows=1,961 loops=1)

  • Output: ledger_entry.currency, ledger_entry.is_credit, ledger_entry.value, billing_account.account_group, billing_account.customer_id
  • Inner Unique: true
  • Hash Cond: (ledger_entry.account_id = billing_account.id)
  • Buffers: shared hit=7,936
5. 0.000 0.000 ↓ 1.1 45,208 1

Parallel Seq Scan on public.ledger_entry (cost=0.00..28,059.18 rows=42,197 width=18) (actual rows=45,208 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
  • Filter: ((ledger_entry.posted_date >= '2019-04-01'::date) AND (ledger_entry.posted_date <= '2019-05-01'::date))
  • Rows Removed by Filter: 462,749
  • Buffers: shared hit=7,688
6. 0.000 0.000 ↓ 17.1 10,540 1

Hash (cost=548.21..548.21 rows=615 width=20) (actual rows=10,540 loops=1)

  • Output: billing_account.account_group, billing_account.id, billing_account.customer_id
  • Buckets: 16,384 (originally 1024) Batches: 1 (originally 1) Memory Usage: 705kB
  • Buffers: shared hit=248
7. 0.000 0.000 ↓ 17.1 10,540 1

Bitmap Heap Scan on public.billing_account (cost=21.92..548.21 rows=615 width=20) (actual rows=10,540 loops=1)

  • Output: billing_account.account_group, billing_account.id, billing_account.customer_id
  • Recheck Cond: (billing_account.account_group = ANY ('{MONTHLY_FEE_INCOME,COMMISSION_INCOME,FEE_PER_E_CODE_INCOME,ADMIN_FEE_INCOME}'::accountgroupenum[]))
  • Heap Blocks: exact=204
  • Buffers: shared hit=248
8. 0.000 0.000 ↓ 17.1 10,540 1

Bitmap Index Scan on billing_account_account_group_idx (cost=0.00..21.77 rows=615 width=0) (actual rows=10,540 loops=1)

  • Index Cond: (billing_account.account_group = ANY ('{MONTHLY_FEE_INCOME,COMMISSION_INCOME,FEE_PER_E_CODE_INCOME,ADMIN_FEE_INCOME}'::accountgroupenum[]))
  • Buffers: shared hit=44
9. 0.000 0.000 ↑ 1.0 155 1

Hash (cost=4.55..4.55 rows=155 width=21) (actual rows=155 loops=1)

  • Output: customer.id, customer.name
  • Buckets: 1,024 Batches: 1 Memory Usage: 17kB
  • Buffers: shared hit=3
10. 0.000 0.000 ↑ 1.0 155 1

Seq Scan on public.customer (cost=0.00..4.55 rows=155 width=21) (actual rows=155 loops=1)

  • Output: customer.id, customer.name
  • Buffers: shared hit=3