explain.depesz.com

PostgreSQL's explain analyze made readable

Result: IuUF

Settings
# exclusive inclusive rows x rows loops node
1. 63.541 193.000 ↓ 17.0 17 1

GroupAggregate (cost=4,542.55..4,542.99 rows=1 width=36) (actual time=125.896..193.000 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=8904
2. 42.717 129.459 ↓ 970.3 41,721 1

Sort (cost=4,542.55..4,542.66 rows=43 width=10) (actual time=125.803..129.459 rows=41,721 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Sort Key: billing_account.currency
  • Sort Method: quicksort Memory: 3492kB
  • Buffers: shared hit=8904
3. 9.082 86.742 ↓ 970.3 41,721 1

Nested Loop (cost=42.71..4,541.38 rows=43 width=10) (actual time=0.219..86.742 rows=41,721 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Buffers: shared hit=8904
4. 0.016 0.191 ↓ 17.0 17 1

Bitmap Heap Scan on public.billing_account (cost=11.32..15.33 rows=1 width=12) (actual time=0.180..0.191 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.014 0.175 ↓ 0.0 0 1

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

  • Buffers: shared hit=14
6. 0.137 0.137 ↓ 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.137..0.137 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. 65.178 77.469 ↓ 1.7 2,454 17

Bitmap Heap Scan on public.ledger_entry (cost=31.39..4,511.90 rows=1,415 width=14) (actual time=0.799..4.557 rows=2,454 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=8655
  • Buffers: shared hit=8883
9. 12.291 12.291 ↓ 2.2 3,128 17

Bitmap Index Scan on ix_ledger_entry_account_id (cost=0.00..31.04 rows=1,415 width=0) (actual time=0.723..0.723 rows=3,128 loops=17)

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