explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uQqf

Settings
# exclusive inclusive rows x rows loops node
1. 0.011 10,755.923 ↑ 1.0 1 1

Nested Loop (cost=944,308.01..944,308.09 rows=1 width=96) (actual time=10,755.922..10,755.923 rows=1 loops=1)

2. 0.000 7,031.478 ↑ 1.0 1 1

Finalize Aggregate (cost=441,734.15..441,734.16 rows=1 width=64) (actual time=7,031.477..7,031.478 rows=1 loops=1)

3. 210.346 7,031.521 ↓ 1.5 3 1

Gather (cost=441,733.90..441,734.11 rows=2 width=96) (actual time=6,794.470..7,031.521 rows=3 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 101.712 6,821.175 ↑ 1.0 1 3 / 3

Partial Aggregate (cost=440,733.90..440,733.91 rows=1 width=96) (actual time=6,821.174..6,821.175 rows=1 loops=3)

5. 178.247 6,719.463 ↓ 2.6 258,700 3 / 3

Nested Loop (cost=266,720.83..439,999.18 rows=97,962 width=24) (actual time=2,429.077..6,719.463 rows=258,700 loops=3)

6. 989.007 5,765.109 ↓ 2.6 258,702 3 / 3

Hash Join (cost=266,720.40..383,706.78 rows=97,694 width=8) (actual time=2,429.054..5,765.109 rows=258,702 loops=3)

  • Hash Cond: (i.location_id = l.id)
  • Join Filter: ((date(timezone(l.time_zone, timezone('UTC'::text, ii.posting_date))) >= '2019-01-01 00:00:00+00'::timestamp with time zone) AND (date(timezone(l.time_zone, timezone('UTC'::text, ii.posting_date))) < '2019-12-31 23:59:59+00'::timestamp with time zone))
  • Rows Removed by Join Filter: 597607
7. 1,731.749 4,776.057 ↑ 1.0 856,309 3 / 3

Hash Join (cost=266,716.47..381,320.67 rows=879,242 width=24) (actual time=2,428.010..4,776.057 rows=856,309 loops=3)

  • Hash Cond: (ii.invoice_id = i.id)
8. 617.555 617.555 ↑ 1.0 889,733 3 / 3

Parallel Seq Scan on invoice_item ii (cost=0.00..89,881.04 rows=919,680 width=24) (actual time=0.006..617.555 rows=889,733 loops=3)

  • Filter: (((service_id IS NOT NULL) OR (inventory_item_id IS NOT NULL)) AND (NOT void))
  • Rows Removed by Filter: 396984
9. 1,017.071 2,426.753 ↓ 1.0 2,428,394 3 / 3

Hash (cost=225,667.20..225,667.20 rows=2,361,462 width=16) (actual time=2,426.753..2,426.753 rows=2,428,394 loops=3)

  • Buckets: 131072 Batches: 64 Memory Usage: 2806kB
10. 1,409.682 1,409.682 ↓ 1.0 2,428,394 3 / 3

Seq Scan on invoice i (cost=0.00..225,667.20 rows=2,361,462 width=16) (actual time=0.007..1,409.682 rows=2,428,394 loops=3)

  • 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: 109387
11. 0.018 0.045 ↑ 1.0 41 3 / 3

Hash (cost=3.41..3.41 rows=41 width=24) (actual time=0.045..0.045 rows=41 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
12. 0.027 0.027 ↑ 1.0 41 3 / 3

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

13. 776.107 776.107 ↑ 1.0 1 776,107 / 3

Index Scan using invoice_item_ledger_pkey on invoice_item_ledger iil (cost=0.43..0.58 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=776,107)

  • Index Cond: (invoice_item_id = ii.id)
14. 0.000 3,724.434 ↑ 1.0 1 1

Finalize Aggregate (cost=502,573.86..502,573.88 rows=1 width=64) (actual time=3,724.434..3,724.434 rows=1 loops=1)

15. 5.263 3,725.363 ↓ 1.5 3 1

Gather (cost=502,573.61..502,573.82 rows=2 width=96) (actual time=3,721.987..3,725.363 rows=3 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
16. 98.080 3,720.100 ↑ 1.0 1 3 / 3

Partial Aggregate (cost=501,573.61..501,573.62 rows=1 width=96) (actual time=3,720.100..3,720.100 rows=1 loops=3)

17. 176.619 3,622.020 ↓ 1.1 260,847 3 / 3

Hash Join (cost=120,068.33..499,852.81 rows=229,440 width=24) (actual time=1,077.478..3,622.020 rows=260,847 loops=3)

  • Hash Cond: (i_1.location_id = l_1.id)
18. 149.364 3,445.357 ↓ 1.1 260,847 3 / 3

Nested Loop (cost=120,064.41..499,184.35 rows=229,440 width=32) (actual time=1,077.392..3,445.357 rows=260,847 loops=3)

19. 906.882 2,513.200 ↓ 1.1 260,931 3 / 3

Hash Join (cost=120,063.98..225,680.91 rows=239,992 width=32) (actual time=1,077.369..2,513.200 rows=260,931 loops=3)

  • Hash Cond: (iil_1.invoice_item_id = ii_1.id)
20. 535.717 535.717 ↑ 1.3 1,286,714 3 / 3

Parallel Seq Scan on invoice_item_ledger iil_1 (cost=0.00..76,526.26 rows=1,612,826 width=32) (actual time=0.004..535.717 rows=1,286,714 loops=3)

21. 351.115 1,070.601 ↓ 1.4 782,799 3 / 3

Hash (cost=110,078.96..110,078.96 rows=574,402 width=16) (actual time=1,070.601..1,070.601 rows=782,799 loops=3)

  • Buckets: 131072 Batches: 16 Memory Usage: 3307kB
22. 537.635 719.486 ↓ 1.4 782,799 3 / 3

Bitmap Heap Scan on invoice_item ii_1 (cost=21,213.60..110,078.96 rows=574,402 width=16) (actual time=192.191..719.486 rows=782,799 loops=3)

  • Recheck Cond: ((created >= '2019-01-01 00:00:00+00'::timestamp with time zone) AND (created < '2019-12-31 23:59:59+00'::timestamp with time zone))
  • Filter: (((service_id IS NOT NULL) OR (inventory_item_id IS NOT NULL)) AND (NOT void))
  • Rows Removed by Filter: 228604
  • Heap Blocks: exact=58279
23. 181.851 181.851 ↓ 1.0 1,011,403 3 / 3

Bitmap Index Scan on invoice_item_created_idx (cost=0.00..21,070.00 rows=1,004,557 width=0) (actual time=181.851..181.851 rows=1,011,403 loops=3)

  • Index Cond: ((created >= '2019-01-01 00:00:00+00'::timestamp with time zone) AND (created < '2019-12-31 23:59:59+00'::timestamp with time zone))
24. 782.793 782.793 ↑ 1.0 1 782,793 / 3

Index Scan using invoice_pkey on invoice i_1 (cost=0.43..1.14 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=782,793)

  • Index Cond: (id = ii_1.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
25. 0.021 0.044 ↑ 1.0 41 3 / 3

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

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
26. 0.023 0.023 ↑ 1.0 41 3 / 3

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

Planning time : 1.677 ms