2

POI 如何快速导出千万级数据的 Excel

 2 years ago
source link: https://www.v2ex.com/t/795136
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Java

POI 如何快速导出千万级数据的 Excel

  Kimen · 6 小时 40 分钟前 · 768 次点击

在使用 POI 导出一千万行数据到 Excel 时,CPU 长时间爆炸💥
现在的解决方案是:

  • 使用 SXSSFWorkbook 类
  • 每 50W 数据划分 sheet
  • 采用多线程,每个 sheet 开一个线程去跑

现已探明的问题:
一千万的数据在创建 Excel 前都存储在 list 中,当 list 占用内存很小时,导出很快,一旦 list 变得很大,分段导出都会变的很慢


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK