explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DqBM

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 256.250 ↓ 1.1 17 1

Finalize GroupAggregate (cost=50,141.95..50,146.12 rows=16 width=36) (actual time=256.209..256.250 rows=17 loops=1)

  • Output: sum((((((is_credit)::integer * '-2'::integer) + 1))::numeric * value)), currency
  • Group Key: ledger_entry.currency
  • Buffers: shared hit=9,211
2. 9.936 256.723 ↓ 1.4 44 1

Gather Merge (cost=50,141.95..50,145.68 rows=32 width=36) (actual time=256.195..256.723 rows=44 loops=1)

  • Output: currency, (PARTIAL sum((((((is_credit)::integer * '-2'::integer) + 1))::numeric * value)))
  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=24,406
3. 0.028 246.787 ↑ 1.1 15 3 / 3

Sort (cost=49,141.92..49,141.96 rows=16 width=36) (actual time=246.785..246.787 rows=15 loops=3)

  • Output: currency, (PARTIAL sum((((((is_credit)::integer * '-2'::integer) + 1))::numeric * value)))
  • Sort Key: ledger_entry.currency
  • Sort Method: quicksort Memory: 26kB
  • Worker 0: Sort Method: quicksort Memory: 26kB
  • Worker 1: Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=24,406
  • Worker 0: actual time=245.291..245.293 rows=17 loops=1
  • Buffers: shared hit=8,465
  • Worker 1: actual time=241.736..241.738 rows=10 loops=1
  • Buffers: shared hit=6,730
4. 150.642 246.759 ↑ 1.1 15 3 / 3

Partial HashAggregate (cost=49,141.40..49,141.60 rows=16 width=36) (actual time=246.743..246.759 rows=15 loops=3)

  • Output: currency, PARTIAL sum((((((is_credit)::integer * '-2'::integer) + 1))::numeric * value))
  • Group Key: ledger_entry.currency
  • Buffers: shared hit=24,390
  • Worker 0: actual time=245.234..245.250 rows=17 loops=1
  • Buffers: shared hit=8,457
  • Worker 1: actual time=241.701..241.711 rows=10 loops=1
  • Buffers: shared hit=6,722
5. 90.859 96.117 ↑ 1.4 62,356 3 / 3

Parallel Bitmap Heap Scan on public.ledger_entry (cost=3,939.88..47,661.88 rows=84,544 width=10) (actual time=14.140..96.117 rows=62,356 loops=3)

  • Output: id, posted_date, journal_id, account_id, value, is_credit, description, invoice_id, currency, product_id, corrected, correction_for_ledger_entry_id, customer_rebate_id
  • Recheck Cond: (ledger_entry.account_id = ANY ('{4184,6863,7557,10711,12579,14091,14093,14095,2993,2995,2997,2999,3001,3003,3005,3007,3009}'::bigint[]))
  • Heap Blocks: exact=8,610
  • Buffers: shared hit=24,390
  • Worker 0: actual time=12.876..92.540 rows=60,886 loops=1
  • Buffers: shared hit=8,457
  • Worker 1: actual time=8.753..98.849 rows=56,526 loops=1
  • Buffers: shared hit=6,722
6. 5.258 5.258 ↑ 1.1 187,067 1 / 3

Bitmap Index Scan on ix_ledger_entry_account_id (cost=0.00..3,889.15 rows=202,906 width=0) (actual time=15.774..15.774 rows=187,067 loops=1)

  • Index Cond: (ledger_entry.account_id = ANY ('{4184,6863,7557,10711,12579,14091,14093,14095,2993,2995,2997,2999,3001,3003,3005,3007,3009}'::bigint[]))
  • Buffers: shared hit=601