explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sbNi

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 2,277.277 ↑ 1.0 1 1

Finalize Aggregate (cost=116,657.76..116,657.77 rows=1 width=64) (actual time=2,277.277..2,277.277 rows=1 loops=1)

2. 3.934 2,278.485 ↓ 1.5 3 1

Gather (cost=116,657.51..116,657.72 rows=2 width=96) (actual time=2,277.029..2,278.485 rows=3 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 97.957 2,274.551 ↑ 1.0 1 3 / 3

Partial Aggregate (cost=115,657.51..115,657.52 rows=1 width=96) (actual time=2,274.551..2,274.551 rows=1 loops=3)

4. 302.163 2,176.594 ↓ 59.2 260,875 3 / 3

Nested Loop (cost=412.99..115,624.44 rows=4,409 width=24) (actual time=73.369..2,176.594 rows=260,875 loops=3)

5. 163.932 1,352.678 ↓ 59.3 260,877 3 / 3

Hash Join (cost=412.56..85,962.49 rows=4,397 width=8) (actual time=73.357..1,352.678 rows=260,877 loops=3)

  • Hash Cond: (i.location_id = l.id)
6. 343.362 1,188.706 ↓ 59.3 260,877 3 / 3

Nested Loop (cost=408.64..85,945.84 rows=4,397 width=16) (actual time=73.276..1,188.706 rows=260,877 loops=3)

7. 301.253 323.422 ↓ 56.7 260,961 3 / 3

Parallel Bitmap Heap Scan on invoice_item ii (cost=408.21..53,096.17 rows=4,599 width=16) (actual time=73.254..323.422 rows=260,961 loops=3)

  • Recheck Cond: ((created_date_ref >= '2019-01-01'::date) AND (created_date_ref <= '2019-12-31'::date))
  • Rows Removed by Index Recheck: 187,856
  • Filter: (((service_id IS NOT NULL) OR (inventory_item_id IS NOT NULL)) AND (NOT void))
  • Rows Removed by Filter: 76,210
  • Heap Blocks: exact=14,237 lossy=11,082
8. 22.169 22.169 ↓ 52.4 1,011,514 1 / 3

Bitmap Index Scan on invoice_item_created_date_ref_idx (cost=0.00..405.45 rows=19,302 width=0) (actual time=66.508..66.508 rows=1,011,514 loops=1)

  • Index Cond: ((created_date_ref >= '2019-01-01'::date) AND (created_date_ref <= '2019-12-31'::date))
9. 521.922 521.922 ↑ 1.0 1 782,883 / 3

Index Scan using invoice_pkey on invoice i (cost=0.43..7.14 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=782,883)

  • Index Cond: (id = ii.invoice_id)
  • Filter: ((NOT void) AND (location_id = ANY ('{0,27,8,16,44,18,14,21,32,25,24,15,30,31,34,10,1,19,17,13,7,45,46,33,23,42,12,11,29,4,28,43,26,20,41,22,6,5,2,3}'::bigint[])))
  • Rows Removed by Filter: 0
10. 0.017 0.040 ↑ 1.0 41 3 / 3

Hash (cost=3.41..3.41 rows=41 width=8) (actual time=0.040..0.040 rows=41 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
11. 0.023 0.023 ↑ 1.0 41 3 / 3

Seq Scan on location l (cost=0.00..3.41 rows=41 width=8) (actual time=0.008..0.023 rows=41 loops=3)

12. 521.753 521.753 ↑ 1.0 1 782,630 / 3

Index Scan using invoice_item_ledger_pkey on invoice_item_ledger iil (cost=0.43..6.75 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=782,630)

  • Index Cond: (invoice_item_id = ii.id)