explain.depesz.com

PostgreSQL's explain analyze made readable

Result: EaPN6

Settings
# exclusive inclusive rows x rows loops node
1. 15.905 194.846 ↓ 17.0 17 1

GroupAggregate (cost=4,639.35..4,639.80 rows=1 width=36) (actual time=175.539..194.846 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=9325
2. 104.120 178.941 ↓ 1,042.5 45,868 1

Sort (cost=4,639.35..4,639.46 rows=44 width=10) (actual time=175.469..178.941 rows=45,868 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Sort Key: billing_account.currency
  • Sort Method: quicksort Memory: 3687kB
  • Buffers: shared hit=9325
3. 14.562 74.821 ↓ 1,042.5 45,868 1

Nested Loop (cost=42.95..4,638.15 rows=44 width=10) (actual time=0.184..74.821 rows=45,868 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Buffers: shared hit=9325
4. 0.015 0.181 ↓ 17.0 17 1

Bitmap Heap Scan on public.billing_account (cost=11.32..15.33 rows=1 width=12) (actual time=0.170..0.181 rows=17 loops=1)

  • Output: billing_account.id, billing_account.account_type, billing_account.contact_id, billing_account.name, billing_account.currency, billing_account.account_group, billing_account.select_link_id, billing_account.customer_id, billing_account.product_id, billing_account.brand_id, billing_account.company_bank_account_id, billing_account.source_currency
  • Recheck Cond: ((billing_account.account_group = 'CUSTOMER_PREPAID_FUNDS'::accountgroupenum) AND (billing_account.customer_id = 175))
  • Heap Blocks: exact=7
  • Buffers: shared hit=21
5. 0.008 0.166 ↓ 0.0 0 1

BitmapAnd (cost=11.32..11.32 rows=1 width=0) (actual time=0.165..0.166 rows=0 loops=1)

  • Buffers: shared hit=14
6. 0.134 0.134 ↓ 17.1 2,635 1

Bitmap Index Scan on billing_account_account_group_idx (cost=0.00..5.44 rows=154 width=0) (actual time=0.134..0.134 rows=2,635 loops=1)

  • Index Cond: (billing_account.account_group = 'CUSTOMER_PREPAID_FUNDS'::accountgroupenum)
  • Buffers: shared hit=10
7. 0.024 0.024 ↓ 1.1 191 1

Bitmap Index Scan on billing_account_customer_id_idx (cost=0.00..5.62 rows=178 width=0) (actual time=0.024..0.024 rows=191 loops=1)

  • Index Cond: (billing_account.customer_id = 175)
  • Buffers: shared hit=4
8. 54.145 60.078 ↓ 1.9 2,698 17

Bitmap Heap Scan on public.ledger_entry (cost=31.63..4,608.36 rows=1,446 width=14) (actual time=0.425..3.534 rows=2,698 loops=17)

  • 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
  • Recheck Cond: (ledger_entry.account_id = billing_account.id)
  • Heap Blocks: exact=9062
  • Buffers: shared hit=9304
9. 5.933 5.933 ↓ 2.3 3,372 17

Bitmap Index Scan on ix_ledger_entry_account_id (cost=0.00..31.27 rows=1,446 width=0) (actual time=0.349..0.349 rows=3,372 loops=17)

  • Index Cond: (ledger_entry.account_id = billing_account.id)
  • Buffers: shared hit=242