I'm writing a migration utility that imports data into an Access database. I'm finding that even very basic inserts take nearly a second to complete.
I'm using the following TypeScript to perform inserts (logging temporarily added to debug performance):
async insert(sql: string): Promise<number> {
try {
console.log(sql);
console.log(`s: ${new Date().toISOString()}`);
const result = await this.conn.execute<LastId[]>(sql, 'SELECT @@IDENTITY as id');
console.log(`e: ${new Date().toISOString()}`);
if (result[0].id < 1) {
throw new Error(`Invalid last identity result ${result[0].id}`);
}
return result[0].id;
} catch (error) {
console.error(error, sql);
throw new Error('Error running SQL');
}
}
Some sample output from this is:
INSERT INTO CancelReasons ([Description]) VALUES ('Defaulted');
s: 2021-08-14T06:39:42.234Z
e: 2021-08-14T06:39:43.037Z
INSERT INTO CancelReasons ([Description]) VALUES ('Medical');
s: 2021-08-14T06:39:43.039Z
e: 2021-08-14T06:39:43.852Z
INSERT INTO CancelReasons ([Description]) VALUES ('moved');
s: 2021-08-14T06:39:43.854Z
e: 2021-08-14T06:39:44.657Z
My machine is relatively fast:
- Windows 10 64-bit, 32GB RAM, SSD drive
- Node 16.6.1
Is this slow performance expected, or is there anything I'm doing wrong?
I'm writing a migration utility that imports data into an Access database. I'm finding that even very basic inserts take nearly a second to complete.
I'm using the following TypeScript to perform inserts (logging temporarily added to debug performance):
Some sample output from this is:
My machine is relatively fast:
Is this slow performance expected, or is there anything I'm doing wrong?