explain.depesz.com

PostgreSQL's explain analyze made readable

Result: IG2C

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 1,431.801 ↓ 1.2 17 1

Finalize GroupAggregate (cost=46,197.74..46,205.70 rows=14 width=36) (actual time=1,338.195..1,431.801 rows=17 loops=1)

  • Output: sum(CASE WHEN ledger_entry.is_credit THEN ('-1'::numeric * ledger_entry.value) ELSE ledger_entry.value END), ledger_entry.currency
  • Group Key: ledger_entry.currency
  • Buffers: shared hit=33,095, temp read=385 written=387
2. 0.506 1,431.832 ↑ 1.6 17 1

Gather Merge (cost=46,197.74..46,205.31 rows=28 width=36) (actual time=1,338.122..1,431.832 rows=17 loops=1)

  • Output: ledger_entry.currency, (PARTIAL sum(CASE WHEN ledger_entry.is_credit THEN ('-1'::numeric * ledger_entry.value) ELSE ledger_entry.value END))
  • Workers Planned: 2
  • Workers Launched: 0
  • Buffers: shared hit=33,095, temp read=385 written=387
3. 52.405 1,431.326 ↓ 1.2 17 1

Partial GroupAggregate (cost=45,197.71..45,202.06 rows=14 width=36) (actual time=1,337.692..1,431.326 rows=17 loops=1)

  • Output: ledger_entry.currency, PARTIAL sum(CASE WHEN ledger_entry.is_credit THEN ('-1'::numeric * ledger_entry.value) ELSE ledger_entry.value END)
  • Group Key: ledger_entry.currency
  • Buffers: shared hit=33,095, temp read=385 written=387
4. 125.784 1,378.921 ↓ 374.6 156,207 1

Sort (cost=45,197.71..45,198.76 rows=417 width=10) (actual time=1,337.602..1,378.921 rows=156,207 loops=1)

  • Output: ledger_entry.currency, ledger_entry.is_credit, ledger_entry.value
  • Sort Key: ledger_entry.currency
  • Sort Method: external merge Disk: 3,080kB
  • Buffers: shared hit=33,095, temp read=385 written=387
5. 737.265 1,253.137 ↓ 374.6 156,207 1

Hash Join (cost=119.41..45,179.57 rows=417 width=10) (actual time=0.588..1,253.137 rows=156,207 loops=1)

  • Output: ledger_entry.currency, ledger_entry.is_credit, ledger_entry.value
  • Inner Unique: true
  • Hash Cond: (ledger_entry.account_id = billing_account.id)
  • Buffers: shared hit=33,095
6. 515.674 515.674 ↓ 2.4 2,270,340 1

Parallel Seq Scan on public.ledger_entry (cost=0.00..42,567.97 rows=949,297 width=18) (actual time=0.004..515.674 rows=2,270,340 loops=1)

  • 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
  • Buffers: shared hit=33,075
7. 0.006 0.198 ↑ 1.0 17 1

Hash (cost=119.20..119.20 rows=17 width=8) (actual time=0.198..0.198 rows=17 loops=1)

  • Output: billing_account.id
  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=20
8. 0.017 0.192 ↑ 1.0 17 1

Bitmap Heap Scan on public.billing_account (cost=59.47..119.20 rows=17 width=8) (actual time=0.182..0.192 rows=17 loops=1)

  • Output: billing_account.id
  • Recheck Cond: ((billing_account.customer_id = 175) AND (billing_account.account_group = 'CUSTOMER_PREPAID_FUNDS'::accountgroupenum))
  • Heap Blocks: exact=7
  • Buffers: shared hit=20
9. 0.008 0.175 ↓ 0.0 0 1

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

  • Buffers: shared hit=13
10. 0.023 0.023 ↑ 1.0 228 1

Bitmap Index Scan on billing_account_customer_id_idx (cost=0.00..6.05 rows=235 width=0) (actual time=0.023..0.023 rows=228 loops=1)

  • Index Cond: (billing_account.customer_id = 175)
  • Buffers: shared hit=2
11. 0.144 0.144 ↓ 1.0 2,788 1

Bitmap Index Scan on billing_account_account_group_idx (cost=0.00..53.15 rows=2,782 width=0) (actual time=0.144..0.144 rows=2,788 loops=1)

  • Index Cond: (billing_account.account_group = 'CUSTOMER_PREPAID_FUNDS'::accountgroupenum)
  • Buffers: shared hit=11