explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uRRM

Settings
# exclusive inclusive rows x rows loops node
1. 22.926 169.131 ↓ 17.0 17 1

GroupAggregate (cost=4,919.40..4,919.87 rows=1 width=36) (actual time=140.285..169.131 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=9190
2. 48.464 146.205 ↓ 1,360.3 62,573 1

Sort (cost=4,919.40..4,919.52 rows=46 width=10) (actual time=140.214..146.205 rows=62,573 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Sort Key: billing_account.currency
  • Sort Method: quicksort Memory: 4470kB
  • Buffers: shared hit=9190
3. 14.873 97.741 ↓ 1,360.3 62,573 1

Nested Loop (cost=47.62..4,918.13 rows=46 width=10) (actual time=0.235..97.741 rows=62,573 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Buffers: shared hit=9190
4. 0.018 0.231 ↓ 17.0 17 1

Bitmap Heap Scan on public.billing_account (cost=11.32..15.33 rows=1 width=12) (actual time=0.218..0.231 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.010 0.213 ↓ 0.0 0 1

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

  • Buffers: shared hit=14
6. 0.176 0.176 ↓ 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.176..0.176 rows=2,635 loops=1)

  • Index Cond: (billing_account.account_group = 'CUSTOMER_PREPAID_FUNDS'::accountgroupenum)
  • Buffers: shared hit=10
7. 0.027 0.027 ↓ 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.027..0.027 rows=191 loops=1)

  • Index Cond: (billing_account.customer_id = 175)
  • Buffers: shared hit=4
8. 68.068 82.637 ↓ 2.4 3,681 17

Bitmap Heap Scan on public.ledger_entry (cost=36.31..4,887.47 rows=1,533 width=14) (actual time=0.937..4.861 rows=3,681 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=8845
  • Buffers: shared hit=9169
9. 14.569 14.569 ↓ 2.4 3,681 17

Bitmap Index Scan on ix_ledger_entry_account_id (cost=0.00..35.93 rows=1,533 width=0) (actual time=0.857..0.857 rows=3,681 loops=17)

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