Skip to content

Commit e2dafbc

Browse files
improvement(tables): raise CSV import batch to 5k rows (param-cap bounded)
1 parent e46c5b5 commit e2dafbc

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

apps/sim/lib/table/import.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ export type CsvColumnType = 'string' | 'number' | 'boolean' | 'date' | 'json'
5050
/** Number of CSV rows sampled when inferring column types for a new table. */
5151
export const CSV_SCHEMA_SAMPLE_SIZE = 100
5252

53-
/** Maximum rows inserted per `batchInsertRows` call during import. */
54-
export const CSV_MAX_BATCH_SIZE = 1000
53+
/**
54+
* Maximum rows inserted per import batch. Each batch is one `INSERT … VALUES` statement, and
55+
* Postgres caps bind parameters at 65,535 — at 9 params per row that's a hard ceiling of ~7,200
56+
* rows, so 5,000 keeps a margin while cutting per-batch overhead (validation, unique-constraint
57+
* check, ownership heartbeat) 5× vs the old 1,000.
58+
*/
59+
export const CSV_MAX_BATCH_SIZE = 5000
5560

5661
/** Maximum CSV/TSV file size accepted by import routes (25 MB). */
5762
export const CSV_MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024

0 commit comments

Comments
 (0)