From 31196094f294485d8bf6e04abe5414e251d07dfb Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 11:19:46 +0000 Subject: [PATCH] perf: batch DROP COLUMN requests in nativeWorker Replaced sequential `worker.call('run')` calls for dropping columns with a single `worker.call('execBatch')`. This eliminates N+1 IPC round-trips to the txiki-js native runtime when deleting multiple columns, significantly reducing latency and improving DDL modification performance. --- src/nativeWorker.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nativeWorker.ts b/src/nativeWorker.ts index 031a813..decd529 100644 --- a/src/nativeWorker.ts +++ b/src/nativeWorker.ts @@ -676,8 +676,11 @@ export async function createNativeDatabaseConnection( case 'column_drop': if (deletedColumns) { - for (const col of deletedColumns) { - await worker.call('run', [`ALTER TABLE ${escapeIdentifier(targetTable)} DROP COLUMN ${escapeIdentifier(col.name)}`]); + const batch = deletedColumns.map(col => ({ + sql: `ALTER TABLE ${escapeIdentifier(targetTable)} DROP COLUMN ${escapeIdentifier(col.name)}` + })); + if (batch.length > 0) { + await worker.call('execBatch', [batch]); } } break;