explain.depesz.com

PostgreSQL's explain analyze made readable

Result: u1P2

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 112,856.519 ↑ 1.0 40 1

Limit (cost=1,192,789.71..1,192,794.38 rows=40 width=349) (actual time=112,856.496..112,856.519 rows=40 loops=1)

  • Output: ledger_entry.id, ledger_entry.posted_date, ledger_entry.journal_id, ledger_entry.account_id, ledger_entry.currency, ledger_entry.value, ledger_entry.is_credit, ledger_entry.description, ledger_entry.invoice_id, ledger_entry.customer_rebate_id, ledger_entry.product_id, ledger_entry.corrected, ledger_entry.correction_for_ledger_entry_id, journal_entry_1.id, journal_entry_1.transaction_date, journal_entry_1.posted_date, journal_entry_1.order_id, journal_entry_1.order_item_id, journal_entry_1.statement_line_id, journal_entry_1.stocked_e_code_id, journal_entry_1.invoice_id, journal_entry_1.customer_rebate_id, journal_entry_1.remittance_id, journal_entry_1.description, billing_account_1.id, billing_account_1.account_type, billing_account_1.account_group, billing_account_1.currency, billing_account_1.contact_id, billing_account_1.name, billing_account_1.select_link_id, billing_account_1.card_payment_id, billing_account_1.customer_id, billing_account_1.product_id, billing_account_1.brand_id, billing_account_1.company_bank_account_id, billing_account_1.source_currency, billing_account_1.payment_provider
  • Buffers: shared hit=99,360, temp read=175,142 written=169,420
2. 481.189 113,319.939 ↑ 278,135.5 40 1

Gather Merge (cost=1,192,789.71..2,490,845.77 rows=11,125,418 width=349) (actual time=112,856.494..113,319.939 rows=40 loops=1)

  • Output: ledger_entry.id, ledger_entry.posted_date, ledger_entry.journal_id, ledger_entry.account_id, ledger_entry.currency, ledger_entry.value, ledger_entry.is_credit, ledger_entry.description, ledger_entry.invoice_id, ledger_entry.customer_rebate_id, ledger_entry.product_id, ledger_entry.corrected, ledger_entry.correction_for_ledger_entry_id, journal_entry_1.id, journal_entry_1.transaction_date, journal_entry_1.posted_date, journal_entry_1.order_id, journal_entry_1.order_item_id, journal_entry_1.statement_line_id, journal_entry_1.stocked_e_code_id, journal_entry_1.invoice_id, journal_entry_1.customer_rebate_id, journal_entry_1.remittance_id, journal_entry_1.description, billing_account_1.id, billing_account_1.account_type, billing_account_1.account_group, billing_account_1.currency, billing_account_1.contact_id, billing_account_1.name, billing_account_1.select_link_id, billing_account_1.card_payment_id, billing_account_1.customer_id, billing_account_1.product_id, billing_account_1.brand_id, billing_account_1.company_bank_account_id, billing_account_1.source_currency, billing_account_1.payment_provider
  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=298,861, temp read=505,556 written=507,980
3. 3,314.048 112,838.750 ↑ 179,442.2 31 3 / 3

Sort (cost=1,191,789.69..1,205,696.46 rows=5,562,709 width=349) (actual time=112,838.746..112,838.750 rows=31 loops=3)

  • Output: ledger_entry.id, ledger_entry.posted_date, ledger_entry.journal_id, ledger_entry.account_id, ledger_entry.currency, ledger_entry.value, ledger_entry.is_credit, ledger_entry.description, ledger_entry.invoice_id, ledger_entry.customer_rebate_id, ledger_entry.product_id, ledger_entry.corrected, ledger_entry.correction_for_ledger_entry_id, journal_entry_1.id, journal_entry_1.transaction_date, journal_entry_1.posted_date, journal_entry_1.order_id, journal_entry_1.order_item_id, journal_entry_1.statement_line_id, journal_entry_1.stocked_e_code_id, journal_entry_1.invoice_id, journal_entry_1.customer_rebate_id, journal_entry_1.remittance_id, journal_entry_1.description, billing_account_1.id, billing_account_1.account_type, billing_account_1.account_group, billing_account_1.currency, billing_account_1.contact_id, billing_account_1.name, billing_account_1.select_link_id, billing_account_1.card_payment_id, billing_account_1.customer_id, billing_account_1.product_id, billing_account_1.brand_id, billing_account_1.company_bank_account_id, billing_account_1.source_currency, billing_account_1.payment_provider
  • Sort Key: ledger_entry.posted_date DESC, ledger_entry.id DESC
  • Sort Method: top-N heapsort Memory: 54kB
  • Worker 0: Sort Method: top-N heapsort Memory: 55kB
  • Worker 1: Sort Method: top-N heapsort Memory: 54kB
  • Buffers: shared hit=298,861, temp read=505,556 written=507,980
  • Worker 0: actual time=112,841.716..112841.720 rows=40 loops=1
  • Buffers: shared hit=99,860, temp read=165,820 written=169,552
  • Worker 1: actual time=112,818.675..112818.681 rows=40 loops=1
  • Buffers: shared hit=99,641, temp read=164,594 written=169,008
4. 51,344.038 109,524.702 ↑ 1.3 4,362,961 3 / 3

Parallel Hash Left Join (cost=164,459.09..1,015,954.46 rows=5,562,709 width=349) (actual time=75,430.541..109,524.702 rows=4,362,961 loops=3)

  • Output: ledger_entry.id, ledger_entry.posted_date, ledger_entry.journal_id, ledger_entry.account_id, ledger_entry.currency, ledger_entry.value, ledger_entry.is_credit, ledger_entry.description, ledger_entry.invoice_id, ledger_entry.customer_rebate_id, ledger_entry.product_id, ledger_entry.corrected, ledger_entry.correction_for_ledger_entry_id, journal_entry_1.id, journal_entry_1.transaction_date, journal_entry_1.posted_date, journal_entry_1.order_id, journal_entry_1.order_item_id, journal_entry_1.statement_line_id, journal_entry_1.stocked_e_code_id, journal_entry_1.invoice_id, journal_entry_1.customer_rebate_id, journal_entry_1.remittance_id, journal_entry_1.description, billing_account_1.id, billing_account_1.account_type, billing_account_1.account_group, billing_account_1.currency, billing_account_1.contact_id, billing_account_1.name, billing_account_1.select_link_id, billing_account_1.card_payment_id, billing_account_1.customer_id, billing_account_1.product_id, billing_account_1.brand_id, billing_account_1.company_bank_account_id, billing_account_1.source_currency, billing_account_1.payment_provider
  • Inner Unique: true
  • Hash Cond: (ledger_entry.account_id = billing_account_1.id)
  • Buffers: shared hit=298,791, temp read=505,556 written=507,980
  • Worker 0: actual time=75,451.619..109538.214 rows=4,299,747 loops=1
  • Buffers: shared hit=99,825, temp read=165,820 written=169,552
  • Worker 1: actual time=75,427.027..109453.805 rows=4,184,282 loops=1
  • Buffers: shared hit=99,606, temp read=164,594 written=169,008
5. 52,115.906 58,107.498 ↑ 1.3 4,362,961 3 / 3

Parallel Hash Left Join (cost=158,967.49..668,381.28 rows=5,562,709 width=216) (actual time=14,533.415..58,107.498 rows=4,362,961 loops=3)

  • Output: ledger_entry.id, ledger_entry.posted_date, ledger_entry.journal_id, ledger_entry.account_id, ledger_entry.currency, ledger_entry.value, ledger_entry.is_credit, ledger_entry.description, ledger_entry.invoice_id, ledger_entry.customer_rebate_id, ledger_entry.product_id, ledger_entry.corrected, ledger_entry.correction_for_ledger_entry_id, journal_entry_1.id, journal_entry_1.transaction_date, journal_entry_1.posted_date, journal_entry_1.order_id, journal_entry_1.order_item_id, journal_entry_1.statement_line_id, journal_entry_1.stocked_e_code_id, journal_entry_1.invoice_id, journal_entry_1.customer_rebate_id, journal_entry_1.remittance_id, journal_entry_1.description
  • Inner Unique: true
  • Hash Cond: (ledger_entry.journal_id = journal_entry_1.id)
  • Buffers: shared hit=296,553, temp read=221,263 written=223,620
  • Worker 0: actual time=14,531.316..58041.144 rows=4,318,247 loops=1
  • Buffers: shared hit=98,764, temp read=72,939 written=75,472
  • Worker 1: actual time=14,535.155..58315.557 rows=4,374,996 loops=1
  • Buffers: shared hit=99,205, temp read=73,928 written=74,268
6. 3,203.305 4,208.883 ↑ 1.3 4,362,961 3 / 3

Parallel Hash Join (cost=3,952.60..291,730.26 rows=5,562,709 width=104) (actual time=55.707..4,208.883 rows=4,362,961 loops=3)

  • Output: ledger_entry.id, ledger_entry.posted_date, ledger_entry.journal_id, ledger_entry.account_id, ledger_entry.currency, ledger_entry.value, ledger_entry.is_credit, ledger_entry.description, ledger_entry.invoice_id, ledger_entry.customer_rebate_id, ledger_entry.product_id, ledger_entry.corrected, ledger_entry.correction_for_ledger_entry_id
  • Inner Unique: true
  • Hash Cond: (ledger_entry.account_id = billing_account.id)
  • Buffers: shared hit=219,728
  • Worker 0: actual time=55.251..4191.540 rows=4,401,684 loops=1
  • Buffers: shared hit=73,668
  • Worker 1: actual time=56.525..4181.801 rows=4,360,785 loops=1
  • Buffers: shared hit=73,084
7. 951.188 951.188 ↑ 1.3 4,362,961 3 / 3

Parallel Seq Scan on public.ledger_entry (cost=0.00..273,175.09 rows=5,562,709 width=104) (actual time=0.006..951.188 rows=4,362,961 loops=3)

  • 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=217,548
  • Worker 0: actual time=0.007..912.739 rows=4,401,684 loops=1
  • Buffers: shared hit=72,892
  • Worker 1: actual time=0.005..953.834 rows=4,360,785 loops=1
  • Buffers: shared hit=72,456
8. 33.079 54.390 ↑ 1.8 44,589 3 / 3

Parallel Hash (cost=2,967.82..2,967.82 rows=78,782 width=8) (actual time=54.390..54.390 rows=44,589 loops=3)

  • Output: billing_account.id
  • Buckets: 262,144 Batches: 1 Memory Usage: 7,360kB
  • Buffers: shared hit=2,180
  • Worker 0: actual time=55.207..55.207 rows=48,504 loops=1
  • Buffers: shared hit=776
  • Worker 1: actual time=52.786..52.787 rows=38,479 loops=1
  • Buffers: shared hit=628
9. 21.311 21.311 ↑ 1.8 44,589 3 / 3

Parallel Seq Scan on public.billing_account (cost=0.00..2,967.82 rows=78,782 width=8) (actual time=0.007..21.311 rows=44,589 loops=3)

  • Output: billing_account.id
  • Buffers: shared hit=2,180
  • Worker 0: actual time=0.007..15.624 rows=48,504 loops=1
  • Buffers: shared hit=776
  • Worker 1: actual time=0.007..30.915 rows=38,479 loops=1
  • Buffers: shared hit=628
10. 1,082.295 1,782.709 ↑ 1.4 1,422,302 3 / 3

Parallel Hash (cost=96,821.40..96,821.40 rows=1,999,640 width=112) (actual time=1,782.709..1,782.709 rows=1,422,302 loops=3)

  • Output: journal_entry_1.id, journal_entry_1.transaction_date, journal_entry_1.posted_date, journal_entry_1.order_id, journal_entry_1.order_item_id, journal_entry_1.statement_line_id, journal_entry_1.stocked_e_code_id, journal_entry_1.invoice_id, journal_entry_1.customer_rebate_id, journal_entry_1.remittance_id, journal_entry_1.description
  • Buckets: 32,768 Batches: 256 Memory Usage: 2,080kB
  • Buffers: shared hit=76,825, temp written=49,844
  • Worker 0: actual time=1,783.211..1783.212 rows=1,464,268 loops=1
  • Buffers: shared hit=25,096, temp written=17,148
  • Worker 1: actual time=1,781.700..1781.700 rows=1,380,681 loops=1
  • Buffers: shared hit=26,121, temp written=16,252
11. 700.414 700.414 ↑ 1.4 1,422,302 3 / 3

Parallel Seq Scan on public.journal_entry journal_entry_1 (cost=0.00..96,821.40 rows=1,999,640 width=112) (actual time=0.011..700.414 rows=1,422,302 loops=3)

  • Output: journal_entry_1.id, journal_entry_1.transaction_date, journal_entry_1.posted_date, journal_entry_1.order_id, journal_entry_1.order_item_id, journal_entry_1.statement_line_id, journal_entry_1.stocked_e_code_id, journal_entry_1.invoice_id, journal_entry_1.customer_rebate_id, journal_entry_1.remittance_id, journal_entry_1.description
  • Buffers: shared hit=76,825
  • Worker 0: actual time=0.011..751.555 rows=1,464,268 loops=1
  • Buffers: shared hit=25,096
  • Worker 1: actual time=0.013..674.399 rows=1,380,681 loops=1
  • Buffers: shared hit=26,121
12. 43.584 73.166 ↑ 1.8 44,589 3 / 3

Parallel Hash (cost=2,967.82..2,967.82 rows=78,782 width=133) (actual time=73.165..73.166 rows=44,589 loops=3)

  • Output: billing_account_1.id, billing_account_1.account_type, billing_account_1.account_group, billing_account_1.currency, billing_account_1.contact_id, billing_account_1.name, billing_account_1.select_link_id, billing_account_1.card_payment_id, billing_account_1.customer_id, billing_account_1.product_id, billing_account_1.brand_id, billing_account_1.company_bank_account_id, billing_account_1.source_currency, billing_account_1.payment_provider
  • Buckets: 32,768 Batches: 8 Memory Usage: 2,496kB
  • Buffers: shared hit=2,180, temp written=1,776
  • Worker 0: actual time=78.104..78.104 rows=64,349 loops=1
  • Buffers: shared hit=1,032, temp written=852
  • Worker 1: actual time=52.934..52.934 rows=20,175 loops=1
  • Buffers: shared hit=372, temp written=280
13. 29.582 29.582 ↑ 1.8 44,589 3 / 3

Parallel Seq Scan on public.billing_account billing_account_1 (cost=0.00..2,967.82 rows=78,782 width=133) (actual time=0.007..29.582 rows=44,589 loops=3)

  • Output: billing_account_1.id, billing_account_1.account_type, billing_account_1.account_group, billing_account_1.currency, billing_account_1.contact_id, billing_account_1.name, billing_account_1.select_link_id, billing_account_1.card_payment_id, billing_account_1.customer_id, billing_account_1.product_id, billing_account_1.brand_id, billing_account_1.company_bank_account_id, billing_account_1.source_currency, billing_account_1.payment_provider
  • Buffers: shared hit=2,180
  • Worker 0: actual time=0.006..25.911 rows=64,349 loops=1
  • Buffers: shared hit=1,032
  • Worker 1: actual time=0.006..22.625 rows=20,175 loops=1
  • Buffers: shared hit=372