explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ybQs

Settings
# exclusive inclusive rows x rows loops node
1. 8.197 127.817 ↓ 17.0 17 1

GroupAggregate (cost=4,545.92..4,546.37 rows=1 width=36) (actual time=117.229..127.817 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=8925
2. 42.044 119.620 ↓ 975.3 41,939 1

Sort (cost=4,545.92..4,546.03 rows=43 width=10) (actual time=117.183..119.620 rows=41,939 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Sort Key: billing_account.currency
  • Sort Method: quicksort Memory: 3502kB
  • Buffers: shared hit=8925
3. 22.318 77.576 ↓ 975.3 41,939 1

Nested Loop (cost=42.72..4,544.76 rows=43 width=10) (actual time=0.211..77.576 rows=41,939 loops=1)

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

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

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

  • Buffers: shared hit=14
6. 0.162 0.162 ↓ 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.162..0.162 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. 45.645 55.046 ↓ 1.7 2,467 17

Bitmap Heap Scan on public.ledger_entry (cost=31.40..4,515.27 rows=1,416 width=14) (actual time=0.637..3.238 rows=2,467 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=8676
  • Buffers: shared hit=8904
9. 9.401 9.401 ↓ 2.2 3,141 17

Bitmap Index Scan on ix_ledger_entry_account_id (cost=0.00..31.05 rows=1,416 width=0) (actual time=0.553..0.553 rows=3,141 loops=17)

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