explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2Vjs

Settings
# exclusive inclusive rows x rows loops node
1. 46.589 387.667 ↓ 17.0 17 1

GroupAggregate (cost=4,944.68..4,945.16 rows=1 width=36) (actual time=332.364..387.667 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=9571
2. 81.449 341.078 ↓ 1,233.6 57,979 1

Sort (cost=4,944.68..4,944.79 rows=47 width=10) (actual time=332.296..341.078 rows=57,979 loops=1)

  • Output: billing_account.currency, ledger_entry.is_credit, ledger_entry.value
  • Sort Key: billing_account.currency
  • Sort Method: quicksort Memory: 4254kB
  • Buffers: shared hit=9571
3. 75.825 259.629 ↓ 1,233.6 57,979 1

Nested Loop (cost=47.69..4,943.37 rows=47 width=10) (actual time=0.221..259.629 rows=57,979 loops=1)

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

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

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

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

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

  • Index Cond: (billing_account.customer_id = 175)
  • Buffers: shared hit=4
8. 176.987 183.583 ↓ 2.2 3,411 17

Bitmap Heap Scan on public.ledger_entry (cost=36.37..4,912.63 rows=1,541 width=14) (actual time=0.472..10.799 rows=3,411 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=9267
  • Buffers: shared hit=9550
9. 6.596 6.596 ↓ 2.2 3,411 17

Bitmap Index Scan on ix_ledger_entry_account_id (cost=0.00..35.98 rows=1,541 width=0) (actual time=0.388..0.388 rows=3,411 loops=17)

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