feat(export): 优化导出数据处理能力
- 将单个文件最大行数从30万提升至50万 - 新增海量数据集批次大小(500万+行)支持 - 将超大数据集批次大小由10万调整至20万 - 根据估算行数新增海量数据集批次选择逻辑 - 增加进度同步间隔至每10万行,减少同步频率 - 保持同步最长时间限制不变,优化性能表现
This commit is contained in:
parent
d96271edf9
commit
6cec327340
|
|
@ -63,7 +63,7 @@ var ExportThresholds = struct {
|
||||||
// XlsxMaxRows xlsx格式最大行数,超过则强制使用csv
|
// XlsxMaxRows xlsx格式最大行数,超过则强制使用csv
|
||||||
XlsxMaxRows int64
|
XlsxMaxRows int64
|
||||||
}{
|
}{
|
||||||
MaxRowsPerFile: 300000,
|
MaxRowsPerFile: 500000, // 修改:单个文件最大5万行数据
|
||||||
PassScoreThreshold: 60,
|
PassScoreThreshold: 60,
|
||||||
ChunkDays: 10,
|
ChunkDays: 10,
|
||||||
ChunkThreshold: 50000,
|
ChunkThreshold: 50000,
|
||||||
|
|
@ -85,16 +85,19 @@ var BatchSizes = struct {
|
||||||
LargeDataset int
|
LargeDataset int
|
||||||
// HugeDataset 超大数据集批次
|
// HugeDataset 超大数据集批次
|
||||||
HugeDataset int
|
HugeDataset int
|
||||||
|
// MassiveDataset 海量数据集批次 (用于 5000万+ 数捥)
|
||||||
|
MassiveDataset int
|
||||||
}{
|
}{
|
||||||
CSVDefault: 10000,
|
CSVDefault: 10000,
|
||||||
XLSXDefault: 5000,
|
XLSXDefault: 5000,
|
||||||
SmallDataset: 10000,
|
SmallDataset: 10000,
|
||||||
MediumDataset: 20000,
|
MediumDataset: 20000,
|
||||||
LargeDataset: 50000,
|
LargeDataset: 50000,
|
||||||
HugeDataset: 100000,
|
HugeDataset: 200000, // 上汪一一次
|
||||||
|
MassiveDataset: 500000, // 新增:海量数据集专用
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChooseBatchSize 根据估算行数和格式选择合适的批次大小
|
// ChooseBatchSize 根据估算行数和格式选择合適的批次大小
|
||||||
func ChooseBatchSize(estimate int64, format FileFormat) int {
|
func ChooseBatchSize(estimate int64, format FileFormat) int {
|
||||||
if format == FileFormatXLSX {
|
if format == FileFormatXLSX {
|
||||||
return BatchSizes.XLSXDefault
|
return BatchSizes.XLSXDefault
|
||||||
|
|
@ -111,6 +114,9 @@ func ChooseBatchSize(estimate int64, format FileFormat) int {
|
||||||
if estimate < 500000 {
|
if estimate < 500000 {
|
||||||
return BatchSizes.LargeDataset
|
return BatchSizes.LargeDataset
|
||||||
}
|
}
|
||||||
|
if estimate >= 50000000 { // 5000万+ 数据
|
||||||
|
return BatchSizes.MassiveDataset
|
||||||
|
}
|
||||||
if estimate >= 2000000 {
|
if estimate >= 2000000 {
|
||||||
return BatchSizes.HugeDataset
|
return BatchSizes.HugeDataset
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ func NewProgressTracker(jobID uint64, metaDB *sql.DB) *ProgressTracker {
|
||||||
lastSyncRows: 0,
|
lastSyncRows: 0,
|
||||||
lastSyncTime: time.Now(),
|
lastSyncTime: time.Now(),
|
||||||
metaDB: metaDB,
|
metaDB: metaDB,
|
||||||
syncInterval: 10000, // 每10000行同步一次
|
syncInterval: 100000, // 每100000行同步一次
|
||||||
timeLimitMS: 5000, // 最长5秒同步一次
|
timeLimitMS: 5000, // 最长5秒同步一次
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue