drizzle-kit 1.0.0-beta.2-e689d82 → 1.0.0-beta.2-0f918b0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-mysql.js +74 -68
- package/api-mysql.mjs +74 -68
- package/api-postgres.js +74 -68
- package/api-postgres.mjs +74 -68
- package/api-sqlite.js +74 -68
- package/api-sqlite.mjs +74 -68
- package/bin.cjs +74 -68
- package/package.json +1 -1
package/api-mysql.js
CHANGED
|
@@ -139775,7 +139775,7 @@ var init_connections = __esm({
|
|
|
139775
139775
|
}
|
|
139776
139776
|
return results;
|
|
139777
139777
|
};
|
|
139778
|
-
const benchmarkQuery = async (sql, params) => {
|
|
139778
|
+
const benchmarkQuery = async (client, sql, params) => {
|
|
139779
139779
|
const explainResult = await pool.query({
|
|
139780
139780
|
text: `EXPLAIN ANALYZE ${sql}`,
|
|
139781
139781
|
values: params ?? [],
|
|
@@ -139786,24 +139786,10 @@ var init_connections = __esm({
|
|
|
139786
139786
|
const executionMatch = stringifiedResult.match(/Execution Time:\s*([\d.]+)\s*ms/i);
|
|
139787
139787
|
const planningTime = Number(planningMatch[1]);
|
|
139788
139788
|
const executionTime = Number(executionMatch[1]);
|
|
139789
|
-
let startAt = 0n;
|
|
139790
|
-
let tcpConnectedAt = 0n;
|
|
139791
|
-
let tlsConnectedAt = null;
|
|
139792
|
-
let dbReadyAt = 0n;
|
|
139793
139789
|
let querySentAt = 0n;
|
|
139794
139790
|
let firstDataAt = 0n;
|
|
139795
139791
|
let lastDataAt = 0n;
|
|
139796
139792
|
let bytesReceived = 0;
|
|
139797
|
-
const client = "url" in credentials ? new pg.Client({ connectionString: credentials.url }) : new pg.Client({ ...credentials, ssl });
|
|
139798
|
-
client.connection.once("connect", () => {
|
|
139799
|
-
tcpConnectedAt = process.hrtime.bigint();
|
|
139800
|
-
});
|
|
139801
|
-
client.connection.prependOnceListener("sslconnect", () => {
|
|
139802
|
-
tlsConnectedAt = process.hrtime.bigint();
|
|
139803
|
-
});
|
|
139804
|
-
client.connection.prependOnceListener("readyForQuery", () => {
|
|
139805
|
-
dbReadyAt = process.hrtime.bigint();
|
|
139806
|
-
});
|
|
139807
139793
|
client.connection.addListener("rowDescription", (data) => {
|
|
139808
139794
|
if (firstDataAt === 0n) {
|
|
139809
139795
|
firstDataAt = process.hrtime.bigint();
|
|
@@ -139816,29 +139802,48 @@ var init_connections = __esm({
|
|
|
139816
139802
|
client.connection.addListener("commandComplete", () => {
|
|
139817
139803
|
lastDataAt = process.hrtime.bigint();
|
|
139818
139804
|
});
|
|
139819
|
-
startAt = process.hrtime.bigint();
|
|
139820
|
-
await client.connect();
|
|
139821
139805
|
querySentAt = process.hrtime.bigint();
|
|
139822
139806
|
await client.query(sql, params);
|
|
139823
|
-
|
|
139807
|
+
client.connection.removeAllListeners("rowDescription");
|
|
139808
|
+
client.connection.removeAllListeners("dataRow");
|
|
139809
|
+
client.connection.removeAllListeners("commandComplete");
|
|
139824
139810
|
return {
|
|
139825
|
-
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
139826
|
-
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
139827
|
-
dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
|
|
139828
139811
|
planning: planningTime,
|
|
139829
139812
|
execution: executionTime,
|
|
139830
139813
|
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime - planningTime,
|
|
139831
|
-
total: ms(
|
|
139814
|
+
total: ms(querySentAt, lastDataAt),
|
|
139832
139815
|
dataSize: bytesReceived
|
|
139833
139816
|
};
|
|
139834
139817
|
};
|
|
139835
139818
|
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
139819
|
+
let startAt = 0n;
|
|
139820
|
+
let tcpConnectedAt = 0n;
|
|
139821
|
+
let tlsConnectedAt = null;
|
|
139822
|
+
let dbReadyAt = 0n;
|
|
139823
|
+
const client = "url" in credentials ? new pg.Client({ connectionString: credentials.url }) : new pg.Client({ ...credentials, ssl });
|
|
139824
|
+
client.connection.once("connect", () => {
|
|
139825
|
+
tcpConnectedAt = process.hrtime.bigint();
|
|
139826
|
+
});
|
|
139827
|
+
client.connection.prependOnceListener("sslconnect", () => {
|
|
139828
|
+
tlsConnectedAt = process.hrtime.bigint();
|
|
139829
|
+
});
|
|
139830
|
+
client.connection.prependOnceListener("readyForQuery", () => {
|
|
139831
|
+
dbReadyAt = process.hrtime.bigint();
|
|
139832
|
+
});
|
|
139833
|
+
startAt = process.hrtime.bigint();
|
|
139834
|
+
await client.connect();
|
|
139836
139835
|
const results = [];
|
|
139837
139836
|
for (let i7 = 0; i7 < repeats; i7++) {
|
|
139838
|
-
const r7 = await benchmarkQuery(sql, params);
|
|
139837
|
+
const r7 = await benchmarkQuery(client, sql, params);
|
|
139839
139838
|
results.push(r7);
|
|
139840
139839
|
}
|
|
139841
|
-
|
|
139840
|
+
await client.end();
|
|
139841
|
+
return {
|
|
139842
|
+
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
139843
|
+
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
139844
|
+
dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
|
|
139845
|
+
queries: results
|
|
139846
|
+
};
|
|
139842
139847
|
};
|
|
139843
139848
|
return { packageName: "pg", query, proxy, transactionProxy, benchmarkProxy, migrate: migrateFn };
|
|
139844
139849
|
}
|
|
@@ -140374,8 +140379,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140374
140379
|
}
|
|
140375
140380
|
return results;
|
|
140376
140381
|
};
|
|
140377
|
-
const benchmarkQuery = async (sql, params) => {
|
|
140378
|
-
const { createConnection: createConnection2 } = require("mysql2");
|
|
140382
|
+
const benchmarkQuery = async (newConnection, sql, params) => {
|
|
140379
140383
|
const explainResult = await connection.query({
|
|
140380
140384
|
sql: `EXPLAIN ANALYZE ${sql}`,
|
|
140381
140385
|
values: params ?? [],
|
|
@@ -140387,13 +140391,45 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140387
140391
|
);
|
|
140388
140392
|
const lastRowTime = Number(timeMatch[2]);
|
|
140389
140393
|
const executionTime = lastRowTime;
|
|
140390
|
-
let startAt = 0n;
|
|
140391
|
-
let tcpConnectedAt = 0n;
|
|
140392
|
-
let tlsConnectedAt = null;
|
|
140393
140394
|
let querySentAt = 0n;
|
|
140394
140395
|
let firstDataAt = 0n;
|
|
140395
140396
|
let lastDataAt = 0n;
|
|
140396
140397
|
let bytesReceived = 0;
|
|
140398
|
+
querySentAt = process.hrtime.bigint();
|
|
140399
|
+
await new Promise((resolve2, reject) => {
|
|
140400
|
+
const query2 = newConnection.query({
|
|
140401
|
+
sql,
|
|
140402
|
+
values: params ?? [],
|
|
140403
|
+
typeCast
|
|
140404
|
+
// rowsAsArray: true,
|
|
140405
|
+
});
|
|
140406
|
+
query2.on("error", (err2) => {
|
|
140407
|
+
reject(err2);
|
|
140408
|
+
});
|
|
140409
|
+
query2.on("fields", (fields) => {
|
|
140410
|
+
if (firstDataAt === 0n) {
|
|
140411
|
+
firstDataAt = process.hrtime.bigint();
|
|
140412
|
+
}
|
|
140413
|
+
bytesReceived += fields[0]._buf.length;
|
|
140414
|
+
});
|
|
140415
|
+
query2.on("end", () => {
|
|
140416
|
+
lastDataAt = process.hrtime.bigint();
|
|
140417
|
+
resolve2();
|
|
140418
|
+
});
|
|
140419
|
+
});
|
|
140420
|
+
return {
|
|
140421
|
+
planning: null,
|
|
140422
|
+
execution: executionTime,
|
|
140423
|
+
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
|
|
140424
|
+
total: ms(querySentAt, lastDataAt),
|
|
140425
|
+
dataSize: bytesReceived
|
|
140426
|
+
};
|
|
140427
|
+
};
|
|
140428
|
+
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
140429
|
+
const { createConnection: createConnection2 } = require("mysql2");
|
|
140430
|
+
let startAt = 0n;
|
|
140431
|
+
let tcpConnectedAt = 0n;
|
|
140432
|
+
let tlsConnectedAt = null;
|
|
140397
140433
|
const createStream = ({ config }) => {
|
|
140398
140434
|
let stream;
|
|
140399
140435
|
if (config.socketPath) {
|
|
@@ -140413,8 +140449,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140413
140449
|
return stream;
|
|
140414
140450
|
};
|
|
140415
140451
|
startAt = process.hrtime.bigint();
|
|
140416
|
-
const
|
|
140417
|
-
// debug: true,
|
|
140452
|
+
const connection2 = result2.url ? createConnection2({
|
|
140418
140453
|
uri: result2.url,
|
|
140419
140454
|
stream: createStream
|
|
140420
140455
|
}) : createConnection2({
|
|
@@ -140422,7 +140457,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140422
140457
|
stream: createStream
|
|
140423
140458
|
});
|
|
140424
140459
|
await new Promise((resolve2, reject) => {
|
|
140425
|
-
|
|
140460
|
+
connection2.connect((err2) => {
|
|
140426
140461
|
tlsConnectedAt = process.hrtime.bigint();
|
|
140427
140462
|
if (err2) {
|
|
140428
140463
|
reject(err2);
|
|
@@ -140431,48 +140466,19 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140431
140466
|
}
|
|
140432
140467
|
});
|
|
140433
140468
|
});
|
|
140434
|
-
|
|
140435
|
-
|
|
140436
|
-
const
|
|
140437
|
-
|
|
140438
|
-
|
|
140439
|
-
|
|
140440
|
-
// rowsAsArray: true,
|
|
140441
|
-
});
|
|
140442
|
-
query2.on("error", (err2) => {
|
|
140443
|
-
reject(err2);
|
|
140444
|
-
});
|
|
140445
|
-
query2.on("fields", (fields) => {
|
|
140446
|
-
if (firstDataAt === 0n) {
|
|
140447
|
-
firstDataAt = process.hrtime.bigint();
|
|
140448
|
-
}
|
|
140449
|
-
bytesReceived += fields[0]._buf.length;
|
|
140450
|
-
});
|
|
140451
|
-
query2.on("end", () => {
|
|
140452
|
-
lastDataAt = process.hrtime.bigint();
|
|
140453
|
-
resolve2();
|
|
140454
|
-
newConnection.end();
|
|
140455
|
-
});
|
|
140456
|
-
});
|
|
140469
|
+
const results = [];
|
|
140470
|
+
for (let i7 = 0; i7 < repeats; i7++) {
|
|
140471
|
+
const r7 = await benchmarkQuery(connection2, sql, params);
|
|
140472
|
+
results.push(r7);
|
|
140473
|
+
}
|
|
140474
|
+
connection2.end();
|
|
140457
140475
|
return {
|
|
140458
140476
|
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
140459
140477
|
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
140460
140478
|
dbHandshake: null,
|
|
140461
|
-
|
|
140462
|
-
execution: executionTime,
|
|
140463
|
-
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
|
|
140464
|
-
total: ms(startAt, lastDataAt),
|
|
140465
|
-
dataSize: bytesReceived
|
|
140479
|
+
queries: results
|
|
140466
140480
|
};
|
|
140467
140481
|
};
|
|
140468
|
-
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
140469
|
-
const results = [];
|
|
140470
|
-
for (let i7 = 0; i7 < repeats; i7++) {
|
|
140471
|
-
const r7 = await benchmarkQuery(sql, params);
|
|
140472
|
-
results.push(r7);
|
|
140473
|
-
}
|
|
140474
|
-
return results;
|
|
140475
|
-
};
|
|
140476
140482
|
return {
|
|
140477
140483
|
db: { query },
|
|
140478
140484
|
packageName: "mysql2",
|
package/api-mysql.mjs
CHANGED
|
@@ -139784,7 +139784,7 @@ var init_connections = __esm({
|
|
|
139784
139784
|
}
|
|
139785
139785
|
return results;
|
|
139786
139786
|
};
|
|
139787
|
-
const benchmarkQuery = async (sql, params) => {
|
|
139787
|
+
const benchmarkQuery = async (client, sql, params) => {
|
|
139788
139788
|
const explainResult = await pool.query({
|
|
139789
139789
|
text: `EXPLAIN ANALYZE ${sql}`,
|
|
139790
139790
|
values: params ?? [],
|
|
@@ -139795,24 +139795,10 @@ var init_connections = __esm({
|
|
|
139795
139795
|
const executionMatch = stringifiedResult.match(/Execution Time:\s*([\d.]+)\s*ms/i);
|
|
139796
139796
|
const planningTime = Number(planningMatch[1]);
|
|
139797
139797
|
const executionTime = Number(executionMatch[1]);
|
|
139798
|
-
let startAt = 0n;
|
|
139799
|
-
let tcpConnectedAt = 0n;
|
|
139800
|
-
let tlsConnectedAt = null;
|
|
139801
|
-
let dbReadyAt = 0n;
|
|
139802
139798
|
let querySentAt = 0n;
|
|
139803
139799
|
let firstDataAt = 0n;
|
|
139804
139800
|
let lastDataAt = 0n;
|
|
139805
139801
|
let bytesReceived = 0;
|
|
139806
|
-
const client = "url" in credentials ? new pg.Client({ connectionString: credentials.url }) : new pg.Client({ ...credentials, ssl });
|
|
139807
|
-
client.connection.once("connect", () => {
|
|
139808
|
-
tcpConnectedAt = process.hrtime.bigint();
|
|
139809
|
-
});
|
|
139810
|
-
client.connection.prependOnceListener("sslconnect", () => {
|
|
139811
|
-
tlsConnectedAt = process.hrtime.bigint();
|
|
139812
|
-
});
|
|
139813
|
-
client.connection.prependOnceListener("readyForQuery", () => {
|
|
139814
|
-
dbReadyAt = process.hrtime.bigint();
|
|
139815
|
-
});
|
|
139816
139802
|
client.connection.addListener("rowDescription", (data) => {
|
|
139817
139803
|
if (firstDataAt === 0n) {
|
|
139818
139804
|
firstDataAt = process.hrtime.bigint();
|
|
@@ -139825,29 +139811,48 @@ var init_connections = __esm({
|
|
|
139825
139811
|
client.connection.addListener("commandComplete", () => {
|
|
139826
139812
|
lastDataAt = process.hrtime.bigint();
|
|
139827
139813
|
});
|
|
139828
|
-
startAt = process.hrtime.bigint();
|
|
139829
|
-
await client.connect();
|
|
139830
139814
|
querySentAt = process.hrtime.bigint();
|
|
139831
139815
|
await client.query(sql, params);
|
|
139832
|
-
|
|
139816
|
+
client.connection.removeAllListeners("rowDescription");
|
|
139817
|
+
client.connection.removeAllListeners("dataRow");
|
|
139818
|
+
client.connection.removeAllListeners("commandComplete");
|
|
139833
139819
|
return {
|
|
139834
|
-
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
139835
|
-
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
139836
|
-
dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
|
|
139837
139820
|
planning: planningTime,
|
|
139838
139821
|
execution: executionTime,
|
|
139839
139822
|
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime - planningTime,
|
|
139840
|
-
total: ms(
|
|
139823
|
+
total: ms(querySentAt, lastDataAt),
|
|
139841
139824
|
dataSize: bytesReceived
|
|
139842
139825
|
};
|
|
139843
139826
|
};
|
|
139844
139827
|
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
139828
|
+
let startAt = 0n;
|
|
139829
|
+
let tcpConnectedAt = 0n;
|
|
139830
|
+
let tlsConnectedAt = null;
|
|
139831
|
+
let dbReadyAt = 0n;
|
|
139832
|
+
const client = "url" in credentials ? new pg.Client({ connectionString: credentials.url }) : new pg.Client({ ...credentials, ssl });
|
|
139833
|
+
client.connection.once("connect", () => {
|
|
139834
|
+
tcpConnectedAt = process.hrtime.bigint();
|
|
139835
|
+
});
|
|
139836
|
+
client.connection.prependOnceListener("sslconnect", () => {
|
|
139837
|
+
tlsConnectedAt = process.hrtime.bigint();
|
|
139838
|
+
});
|
|
139839
|
+
client.connection.prependOnceListener("readyForQuery", () => {
|
|
139840
|
+
dbReadyAt = process.hrtime.bigint();
|
|
139841
|
+
});
|
|
139842
|
+
startAt = process.hrtime.bigint();
|
|
139843
|
+
await client.connect();
|
|
139845
139844
|
const results = [];
|
|
139846
139845
|
for (let i7 = 0; i7 < repeats; i7++) {
|
|
139847
|
-
const r7 = await benchmarkQuery(sql, params);
|
|
139846
|
+
const r7 = await benchmarkQuery(client, sql, params);
|
|
139848
139847
|
results.push(r7);
|
|
139849
139848
|
}
|
|
139850
|
-
|
|
139849
|
+
await client.end();
|
|
139850
|
+
return {
|
|
139851
|
+
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
139852
|
+
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
139853
|
+
dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
|
|
139854
|
+
queries: results
|
|
139855
|
+
};
|
|
139851
139856
|
};
|
|
139852
139857
|
return { packageName: "pg", query, proxy, transactionProxy, benchmarkProxy, migrate: migrateFn };
|
|
139853
139858
|
}
|
|
@@ -140383,8 +140388,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140383
140388
|
}
|
|
140384
140389
|
return results;
|
|
140385
140390
|
};
|
|
140386
|
-
const benchmarkQuery = async (sql, params) => {
|
|
140387
|
-
const { createConnection: createConnection2 } = await import("mysql2");
|
|
140391
|
+
const benchmarkQuery = async (newConnection, sql, params) => {
|
|
140388
140392
|
const explainResult = await connection.query({
|
|
140389
140393
|
sql: `EXPLAIN ANALYZE ${sql}`,
|
|
140390
140394
|
values: params ?? [],
|
|
@@ -140396,13 +140400,45 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140396
140400
|
);
|
|
140397
140401
|
const lastRowTime = Number(timeMatch[2]);
|
|
140398
140402
|
const executionTime = lastRowTime;
|
|
140399
|
-
let startAt = 0n;
|
|
140400
|
-
let tcpConnectedAt = 0n;
|
|
140401
|
-
let tlsConnectedAt = null;
|
|
140402
140403
|
let querySentAt = 0n;
|
|
140403
140404
|
let firstDataAt = 0n;
|
|
140404
140405
|
let lastDataAt = 0n;
|
|
140405
140406
|
let bytesReceived = 0;
|
|
140407
|
+
querySentAt = process.hrtime.bigint();
|
|
140408
|
+
await new Promise((resolve2, reject) => {
|
|
140409
|
+
const query2 = newConnection.query({
|
|
140410
|
+
sql,
|
|
140411
|
+
values: params ?? [],
|
|
140412
|
+
typeCast
|
|
140413
|
+
// rowsAsArray: true,
|
|
140414
|
+
});
|
|
140415
|
+
query2.on("error", (err2) => {
|
|
140416
|
+
reject(err2);
|
|
140417
|
+
});
|
|
140418
|
+
query2.on("fields", (fields) => {
|
|
140419
|
+
if (firstDataAt === 0n) {
|
|
140420
|
+
firstDataAt = process.hrtime.bigint();
|
|
140421
|
+
}
|
|
140422
|
+
bytesReceived += fields[0]._buf.length;
|
|
140423
|
+
});
|
|
140424
|
+
query2.on("end", () => {
|
|
140425
|
+
lastDataAt = process.hrtime.bigint();
|
|
140426
|
+
resolve2();
|
|
140427
|
+
});
|
|
140428
|
+
});
|
|
140429
|
+
return {
|
|
140430
|
+
planning: null,
|
|
140431
|
+
execution: executionTime,
|
|
140432
|
+
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
|
|
140433
|
+
total: ms(querySentAt, lastDataAt),
|
|
140434
|
+
dataSize: bytesReceived
|
|
140435
|
+
};
|
|
140436
|
+
};
|
|
140437
|
+
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
140438
|
+
const { createConnection: createConnection2 } = await import("mysql2");
|
|
140439
|
+
let startAt = 0n;
|
|
140440
|
+
let tcpConnectedAt = 0n;
|
|
140441
|
+
let tlsConnectedAt = null;
|
|
140406
140442
|
const createStream = ({ config }) => {
|
|
140407
140443
|
let stream;
|
|
140408
140444
|
if (config.socketPath) {
|
|
@@ -140422,8 +140458,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140422
140458
|
return stream;
|
|
140423
140459
|
};
|
|
140424
140460
|
startAt = process.hrtime.bigint();
|
|
140425
|
-
const
|
|
140426
|
-
// debug: true,
|
|
140461
|
+
const connection2 = result2.url ? createConnection2({
|
|
140427
140462
|
uri: result2.url,
|
|
140428
140463
|
stream: createStream
|
|
140429
140464
|
}) : createConnection2({
|
|
@@ -140431,7 +140466,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140431
140466
|
stream: createStream
|
|
140432
140467
|
});
|
|
140433
140468
|
await new Promise((resolve2, reject) => {
|
|
140434
|
-
|
|
140469
|
+
connection2.connect((err2) => {
|
|
140435
140470
|
tlsConnectedAt = process.hrtime.bigint();
|
|
140436
140471
|
if (err2) {
|
|
140437
140472
|
reject(err2);
|
|
@@ -140440,48 +140475,19 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
140440
140475
|
}
|
|
140441
140476
|
});
|
|
140442
140477
|
});
|
|
140443
|
-
|
|
140444
|
-
|
|
140445
|
-
const
|
|
140446
|
-
|
|
140447
|
-
|
|
140448
|
-
|
|
140449
|
-
// rowsAsArray: true,
|
|
140450
|
-
});
|
|
140451
|
-
query2.on("error", (err2) => {
|
|
140452
|
-
reject(err2);
|
|
140453
|
-
});
|
|
140454
|
-
query2.on("fields", (fields) => {
|
|
140455
|
-
if (firstDataAt === 0n) {
|
|
140456
|
-
firstDataAt = process.hrtime.bigint();
|
|
140457
|
-
}
|
|
140458
|
-
bytesReceived += fields[0]._buf.length;
|
|
140459
|
-
});
|
|
140460
|
-
query2.on("end", () => {
|
|
140461
|
-
lastDataAt = process.hrtime.bigint();
|
|
140462
|
-
resolve2();
|
|
140463
|
-
newConnection.end();
|
|
140464
|
-
});
|
|
140465
|
-
});
|
|
140478
|
+
const results = [];
|
|
140479
|
+
for (let i7 = 0; i7 < repeats; i7++) {
|
|
140480
|
+
const r7 = await benchmarkQuery(connection2, sql, params);
|
|
140481
|
+
results.push(r7);
|
|
140482
|
+
}
|
|
140483
|
+
connection2.end();
|
|
140466
140484
|
return {
|
|
140467
140485
|
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
140468
140486
|
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
140469
140487
|
dbHandshake: null,
|
|
140470
|
-
|
|
140471
|
-
execution: executionTime,
|
|
140472
|
-
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
|
|
140473
|
-
total: ms(startAt, lastDataAt),
|
|
140474
|
-
dataSize: bytesReceived
|
|
140488
|
+
queries: results
|
|
140475
140489
|
};
|
|
140476
140490
|
};
|
|
140477
|
-
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
140478
|
-
const results = [];
|
|
140479
|
-
for (let i7 = 0; i7 < repeats; i7++) {
|
|
140480
|
-
const r7 = await benchmarkQuery(sql, params);
|
|
140481
|
-
results.push(r7);
|
|
140482
|
-
}
|
|
140483
|
-
return results;
|
|
140484
|
-
};
|
|
140485
140491
|
return {
|
|
140486
140492
|
db: { query },
|
|
140487
140493
|
packageName: "mysql2",
|
package/api-postgres.js
CHANGED
|
@@ -145453,7 +145453,7 @@ var init_connections = __esm({
|
|
|
145453
145453
|
}
|
|
145454
145454
|
return results;
|
|
145455
145455
|
};
|
|
145456
|
-
const benchmarkQuery = async (sql, params) => {
|
|
145456
|
+
const benchmarkQuery = async (client, sql, params) => {
|
|
145457
145457
|
const explainResult = await pool.query({
|
|
145458
145458
|
text: `EXPLAIN ANALYZE ${sql}`,
|
|
145459
145459
|
values: params ?? [],
|
|
@@ -145464,24 +145464,10 @@ var init_connections = __esm({
|
|
|
145464
145464
|
const executionMatch = stringifiedResult.match(/Execution Time:\s*([\d.]+)\s*ms/i);
|
|
145465
145465
|
const planningTime = Number(planningMatch[1]);
|
|
145466
145466
|
const executionTime = Number(executionMatch[1]);
|
|
145467
|
-
let startAt = 0n;
|
|
145468
|
-
let tcpConnectedAt = 0n;
|
|
145469
|
-
let tlsConnectedAt = null;
|
|
145470
|
-
let dbReadyAt = 0n;
|
|
145471
145467
|
let querySentAt = 0n;
|
|
145472
145468
|
let firstDataAt = 0n;
|
|
145473
145469
|
let lastDataAt = 0n;
|
|
145474
145470
|
let bytesReceived = 0;
|
|
145475
|
-
const client = "url" in credentials ? new pg.Client({ connectionString: credentials.url }) : new pg.Client({ ...credentials, ssl });
|
|
145476
|
-
client.connection.once("connect", () => {
|
|
145477
|
-
tcpConnectedAt = process.hrtime.bigint();
|
|
145478
|
-
});
|
|
145479
|
-
client.connection.prependOnceListener("sslconnect", () => {
|
|
145480
|
-
tlsConnectedAt = process.hrtime.bigint();
|
|
145481
|
-
});
|
|
145482
|
-
client.connection.prependOnceListener("readyForQuery", () => {
|
|
145483
|
-
dbReadyAt = process.hrtime.bigint();
|
|
145484
|
-
});
|
|
145485
145471
|
client.connection.addListener("rowDescription", (data) => {
|
|
145486
145472
|
if (firstDataAt === 0n) {
|
|
145487
145473
|
firstDataAt = process.hrtime.bigint();
|
|
@@ -145494,29 +145480,48 @@ var init_connections = __esm({
|
|
|
145494
145480
|
client.connection.addListener("commandComplete", () => {
|
|
145495
145481
|
lastDataAt = process.hrtime.bigint();
|
|
145496
145482
|
});
|
|
145497
|
-
startAt = process.hrtime.bigint();
|
|
145498
|
-
await client.connect();
|
|
145499
145483
|
querySentAt = process.hrtime.bigint();
|
|
145500
145484
|
await client.query(sql, params);
|
|
145501
|
-
|
|
145485
|
+
client.connection.removeAllListeners("rowDescription");
|
|
145486
|
+
client.connection.removeAllListeners("dataRow");
|
|
145487
|
+
client.connection.removeAllListeners("commandComplete");
|
|
145502
145488
|
return {
|
|
145503
|
-
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
145504
|
-
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
145505
|
-
dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
|
|
145506
145489
|
planning: planningTime,
|
|
145507
145490
|
execution: executionTime,
|
|
145508
145491
|
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime - planningTime,
|
|
145509
|
-
total: ms(
|
|
145492
|
+
total: ms(querySentAt, lastDataAt),
|
|
145510
145493
|
dataSize: bytesReceived
|
|
145511
145494
|
};
|
|
145512
145495
|
};
|
|
145513
145496
|
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
145497
|
+
let startAt = 0n;
|
|
145498
|
+
let tcpConnectedAt = 0n;
|
|
145499
|
+
let tlsConnectedAt = null;
|
|
145500
|
+
let dbReadyAt = 0n;
|
|
145501
|
+
const client = "url" in credentials ? new pg.Client({ connectionString: credentials.url }) : new pg.Client({ ...credentials, ssl });
|
|
145502
|
+
client.connection.once("connect", () => {
|
|
145503
|
+
tcpConnectedAt = process.hrtime.bigint();
|
|
145504
|
+
});
|
|
145505
|
+
client.connection.prependOnceListener("sslconnect", () => {
|
|
145506
|
+
tlsConnectedAt = process.hrtime.bigint();
|
|
145507
|
+
});
|
|
145508
|
+
client.connection.prependOnceListener("readyForQuery", () => {
|
|
145509
|
+
dbReadyAt = process.hrtime.bigint();
|
|
145510
|
+
});
|
|
145511
|
+
startAt = process.hrtime.bigint();
|
|
145512
|
+
await client.connect();
|
|
145514
145513
|
const results = [];
|
|
145515
145514
|
for (let i7 = 0; i7 < repeats; i7++) {
|
|
145516
|
-
const r7 = await benchmarkQuery(sql, params);
|
|
145515
|
+
const r7 = await benchmarkQuery(client, sql, params);
|
|
145517
145516
|
results.push(r7);
|
|
145518
145517
|
}
|
|
145519
|
-
|
|
145518
|
+
await client.end();
|
|
145519
|
+
return {
|
|
145520
|
+
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
145521
|
+
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
145522
|
+
dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
|
|
145523
|
+
queries: results
|
|
145524
|
+
};
|
|
145520
145525
|
};
|
|
145521
145526
|
return { packageName: "pg", query, proxy, transactionProxy, benchmarkProxy, migrate: migrateFn };
|
|
145522
145527
|
}
|
|
@@ -146052,8 +146057,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146052
146057
|
}
|
|
146053
146058
|
return results;
|
|
146054
146059
|
};
|
|
146055
|
-
const benchmarkQuery = async (sql, params) => {
|
|
146056
|
-
const { createConnection: createConnection2 } = require("mysql2");
|
|
146060
|
+
const benchmarkQuery = async (newConnection, sql, params) => {
|
|
146057
146061
|
const explainResult = await connection.query({
|
|
146058
146062
|
sql: `EXPLAIN ANALYZE ${sql}`,
|
|
146059
146063
|
values: params ?? [],
|
|
@@ -146065,13 +146069,45 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146065
146069
|
);
|
|
146066
146070
|
const lastRowTime = Number(timeMatch[2]);
|
|
146067
146071
|
const executionTime = lastRowTime;
|
|
146068
|
-
let startAt = 0n;
|
|
146069
|
-
let tcpConnectedAt = 0n;
|
|
146070
|
-
let tlsConnectedAt = null;
|
|
146071
146072
|
let querySentAt = 0n;
|
|
146072
146073
|
let firstDataAt = 0n;
|
|
146073
146074
|
let lastDataAt = 0n;
|
|
146074
146075
|
let bytesReceived = 0;
|
|
146076
|
+
querySentAt = process.hrtime.bigint();
|
|
146077
|
+
await new Promise((resolve2, reject) => {
|
|
146078
|
+
const query2 = newConnection.query({
|
|
146079
|
+
sql,
|
|
146080
|
+
values: params ?? [],
|
|
146081
|
+
typeCast
|
|
146082
|
+
// rowsAsArray: true,
|
|
146083
|
+
});
|
|
146084
|
+
query2.on("error", (err2) => {
|
|
146085
|
+
reject(err2);
|
|
146086
|
+
});
|
|
146087
|
+
query2.on("fields", (fields) => {
|
|
146088
|
+
if (firstDataAt === 0n) {
|
|
146089
|
+
firstDataAt = process.hrtime.bigint();
|
|
146090
|
+
}
|
|
146091
|
+
bytesReceived += fields[0]._buf.length;
|
|
146092
|
+
});
|
|
146093
|
+
query2.on("end", () => {
|
|
146094
|
+
lastDataAt = process.hrtime.bigint();
|
|
146095
|
+
resolve2();
|
|
146096
|
+
});
|
|
146097
|
+
});
|
|
146098
|
+
return {
|
|
146099
|
+
planning: null,
|
|
146100
|
+
execution: executionTime,
|
|
146101
|
+
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
|
|
146102
|
+
total: ms(querySentAt, lastDataAt),
|
|
146103
|
+
dataSize: bytesReceived
|
|
146104
|
+
};
|
|
146105
|
+
};
|
|
146106
|
+
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
146107
|
+
const { createConnection: createConnection2 } = require("mysql2");
|
|
146108
|
+
let startAt = 0n;
|
|
146109
|
+
let tcpConnectedAt = 0n;
|
|
146110
|
+
let tlsConnectedAt = null;
|
|
146075
146111
|
const createStream = ({ config }) => {
|
|
146076
146112
|
let stream;
|
|
146077
146113
|
if (config.socketPath) {
|
|
@@ -146091,8 +146127,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146091
146127
|
return stream;
|
|
146092
146128
|
};
|
|
146093
146129
|
startAt = process.hrtime.bigint();
|
|
146094
|
-
const
|
|
146095
|
-
// debug: true,
|
|
146130
|
+
const connection2 = result2.url ? createConnection2({
|
|
146096
146131
|
uri: result2.url,
|
|
146097
146132
|
stream: createStream
|
|
146098
146133
|
}) : createConnection2({
|
|
@@ -146100,7 +146135,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146100
146135
|
stream: createStream
|
|
146101
146136
|
});
|
|
146102
146137
|
await new Promise((resolve2, reject) => {
|
|
146103
|
-
|
|
146138
|
+
connection2.connect((err2) => {
|
|
146104
146139
|
tlsConnectedAt = process.hrtime.bigint();
|
|
146105
146140
|
if (err2) {
|
|
146106
146141
|
reject(err2);
|
|
@@ -146109,48 +146144,19 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146109
146144
|
}
|
|
146110
146145
|
});
|
|
146111
146146
|
});
|
|
146112
|
-
|
|
146113
|
-
|
|
146114
|
-
const
|
|
146115
|
-
|
|
146116
|
-
|
|
146117
|
-
|
|
146118
|
-
// rowsAsArray: true,
|
|
146119
|
-
});
|
|
146120
|
-
query2.on("error", (err2) => {
|
|
146121
|
-
reject(err2);
|
|
146122
|
-
});
|
|
146123
|
-
query2.on("fields", (fields) => {
|
|
146124
|
-
if (firstDataAt === 0n) {
|
|
146125
|
-
firstDataAt = process.hrtime.bigint();
|
|
146126
|
-
}
|
|
146127
|
-
bytesReceived += fields[0]._buf.length;
|
|
146128
|
-
});
|
|
146129
|
-
query2.on("end", () => {
|
|
146130
|
-
lastDataAt = process.hrtime.bigint();
|
|
146131
|
-
resolve2();
|
|
146132
|
-
newConnection.end();
|
|
146133
|
-
});
|
|
146134
|
-
});
|
|
146147
|
+
const results = [];
|
|
146148
|
+
for (let i7 = 0; i7 < repeats; i7++) {
|
|
146149
|
+
const r7 = await benchmarkQuery(connection2, sql, params);
|
|
146150
|
+
results.push(r7);
|
|
146151
|
+
}
|
|
146152
|
+
connection2.end();
|
|
146135
146153
|
return {
|
|
146136
146154
|
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
146137
146155
|
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
146138
146156
|
dbHandshake: null,
|
|
146139
|
-
|
|
146140
|
-
execution: executionTime,
|
|
146141
|
-
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
|
|
146142
|
-
total: ms(startAt, lastDataAt),
|
|
146143
|
-
dataSize: bytesReceived
|
|
146157
|
+
queries: results
|
|
146144
146158
|
};
|
|
146145
146159
|
};
|
|
146146
|
-
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
146147
|
-
const results = [];
|
|
146148
|
-
for (let i7 = 0; i7 < repeats; i7++) {
|
|
146149
|
-
const r7 = await benchmarkQuery(sql, params);
|
|
146150
|
-
results.push(r7);
|
|
146151
|
-
}
|
|
146152
|
-
return results;
|
|
146153
|
-
};
|
|
146154
146160
|
return {
|
|
146155
146161
|
db: { query },
|
|
146156
146162
|
packageName: "mysql2",
|