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-postgres.mjs
CHANGED
|
@@ -145486,7 +145486,7 @@ var init_connections = __esm({
|
|
|
145486
145486
|
}
|
|
145487
145487
|
return results;
|
|
145488
145488
|
};
|
|
145489
|
-
const benchmarkQuery = async (sql, params) => {
|
|
145489
|
+
const benchmarkQuery = async (client, sql, params) => {
|
|
145490
145490
|
const explainResult = await pool.query({
|
|
145491
145491
|
text: `EXPLAIN ANALYZE ${sql}`,
|
|
145492
145492
|
values: params ?? [],
|
|
@@ -145497,24 +145497,10 @@ var init_connections = __esm({
|
|
|
145497
145497
|
const executionMatch = stringifiedResult.match(/Execution Time:\s*([\d.]+)\s*ms/i);
|
|
145498
145498
|
const planningTime = Number(planningMatch[1]);
|
|
145499
145499
|
const executionTime = Number(executionMatch[1]);
|
|
145500
|
-
let startAt = 0n;
|
|
145501
|
-
let tcpConnectedAt = 0n;
|
|
145502
|
-
let tlsConnectedAt = null;
|
|
145503
|
-
let dbReadyAt = 0n;
|
|
145504
145500
|
let querySentAt = 0n;
|
|
145505
145501
|
let firstDataAt = 0n;
|
|
145506
145502
|
let lastDataAt = 0n;
|
|
145507
145503
|
let bytesReceived = 0;
|
|
145508
|
-
const client = "url" in credentials ? new pg.Client({ connectionString: credentials.url }) : new pg.Client({ ...credentials, ssl });
|
|
145509
|
-
client.connection.once("connect", () => {
|
|
145510
|
-
tcpConnectedAt = process.hrtime.bigint();
|
|
145511
|
-
});
|
|
145512
|
-
client.connection.prependOnceListener("sslconnect", () => {
|
|
145513
|
-
tlsConnectedAt = process.hrtime.bigint();
|
|
145514
|
-
});
|
|
145515
|
-
client.connection.prependOnceListener("readyForQuery", () => {
|
|
145516
|
-
dbReadyAt = process.hrtime.bigint();
|
|
145517
|
-
});
|
|
145518
145504
|
client.connection.addListener("rowDescription", (data) => {
|
|
145519
145505
|
if (firstDataAt === 0n) {
|
|
145520
145506
|
firstDataAt = process.hrtime.bigint();
|
|
@@ -145527,29 +145513,48 @@ var init_connections = __esm({
|
|
|
145527
145513
|
client.connection.addListener("commandComplete", () => {
|
|
145528
145514
|
lastDataAt = process.hrtime.bigint();
|
|
145529
145515
|
});
|
|
145530
|
-
startAt = process.hrtime.bigint();
|
|
145531
|
-
await client.connect();
|
|
145532
145516
|
querySentAt = process.hrtime.bigint();
|
|
145533
145517
|
await client.query(sql, params);
|
|
145534
|
-
|
|
145518
|
+
client.connection.removeAllListeners("rowDescription");
|
|
145519
|
+
client.connection.removeAllListeners("dataRow");
|
|
145520
|
+
client.connection.removeAllListeners("commandComplete");
|
|
145535
145521
|
return {
|
|
145536
|
-
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
145537
|
-
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
145538
|
-
dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
|
|
145539
145522
|
planning: planningTime,
|
|
145540
145523
|
execution: executionTime,
|
|
145541
145524
|
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime - planningTime,
|
|
145542
|
-
total: ms(
|
|
145525
|
+
total: ms(querySentAt, lastDataAt),
|
|
145543
145526
|
dataSize: bytesReceived
|
|
145544
145527
|
};
|
|
145545
145528
|
};
|
|
145546
145529
|
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
145530
|
+
let startAt = 0n;
|
|
145531
|
+
let tcpConnectedAt = 0n;
|
|
145532
|
+
let tlsConnectedAt = null;
|
|
145533
|
+
let dbReadyAt = 0n;
|
|
145534
|
+
const client = "url" in credentials ? new pg.Client({ connectionString: credentials.url }) : new pg.Client({ ...credentials, ssl });
|
|
145535
|
+
client.connection.once("connect", () => {
|
|
145536
|
+
tcpConnectedAt = process.hrtime.bigint();
|
|
145537
|
+
});
|
|
145538
|
+
client.connection.prependOnceListener("sslconnect", () => {
|
|
145539
|
+
tlsConnectedAt = process.hrtime.bigint();
|
|
145540
|
+
});
|
|
145541
|
+
client.connection.prependOnceListener("readyForQuery", () => {
|
|
145542
|
+
dbReadyAt = process.hrtime.bigint();
|
|
145543
|
+
});
|
|
145544
|
+
startAt = process.hrtime.bigint();
|
|
145545
|
+
await client.connect();
|
|
145547
145546
|
const results = [];
|
|
145548
145547
|
for (let i7 = 0; i7 < repeats; i7++) {
|
|
145549
|
-
const r7 = await benchmarkQuery(sql, params);
|
|
145548
|
+
const r7 = await benchmarkQuery(client, sql, params);
|
|
145550
145549
|
results.push(r7);
|
|
145551
145550
|
}
|
|
145552
|
-
|
|
145551
|
+
await client.end();
|
|
145552
|
+
return {
|
|
145553
|
+
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
145554
|
+
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
145555
|
+
dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
|
|
145556
|
+
queries: results
|
|
145557
|
+
};
|
|
145553
145558
|
};
|
|
145554
145559
|
return { packageName: "pg", query, proxy, transactionProxy, benchmarkProxy, migrate: migrateFn };
|
|
145555
145560
|
}
|
|
@@ -146085,8 +146090,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146085
146090
|
}
|
|
146086
146091
|
return results;
|
|
146087
146092
|
};
|
|
146088
|
-
const benchmarkQuery = async (sql, params) => {
|
|
146089
|
-
const { createConnection: createConnection2 } = await import("mysql2");
|
|
146093
|
+
const benchmarkQuery = async (newConnection, sql, params) => {
|
|
146090
146094
|
const explainResult = await connection.query({
|
|
146091
146095
|
sql: `EXPLAIN ANALYZE ${sql}`,
|
|
146092
146096
|
values: params ?? [],
|
|
@@ -146098,13 +146102,45 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146098
146102
|
);
|
|
146099
146103
|
const lastRowTime = Number(timeMatch[2]);
|
|
146100
146104
|
const executionTime = lastRowTime;
|
|
146101
|
-
let startAt = 0n;
|
|
146102
|
-
let tcpConnectedAt = 0n;
|
|
146103
|
-
let tlsConnectedAt = null;
|
|
146104
146105
|
let querySentAt = 0n;
|
|
146105
146106
|
let firstDataAt = 0n;
|
|
146106
146107
|
let lastDataAt = 0n;
|
|
146107
146108
|
let bytesReceived = 0;
|
|
146109
|
+
querySentAt = process.hrtime.bigint();
|
|
146110
|
+
await new Promise((resolve2, reject) => {
|
|
146111
|
+
const query2 = newConnection.query({
|
|
146112
|
+
sql,
|
|
146113
|
+
values: params ?? [],
|
|
146114
|
+
typeCast
|
|
146115
|
+
// rowsAsArray: true,
|
|
146116
|
+
});
|
|
146117
|
+
query2.on("error", (err2) => {
|
|
146118
|
+
reject(err2);
|
|
146119
|
+
});
|
|
146120
|
+
query2.on("fields", (fields) => {
|
|
146121
|
+
if (firstDataAt === 0n) {
|
|
146122
|
+
firstDataAt = process.hrtime.bigint();
|
|
146123
|
+
}
|
|
146124
|
+
bytesReceived += fields[0]._buf.length;
|
|
146125
|
+
});
|
|
146126
|
+
query2.on("end", () => {
|
|
146127
|
+
lastDataAt = process.hrtime.bigint();
|
|
146128
|
+
resolve2();
|
|
146129
|
+
});
|
|
146130
|
+
});
|
|
146131
|
+
return {
|
|
146132
|
+
planning: null,
|
|
146133
|
+
execution: executionTime,
|
|
146134
|
+
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
|
|
146135
|
+
total: ms(querySentAt, lastDataAt),
|
|
146136
|
+
dataSize: bytesReceived
|
|
146137
|
+
};
|
|
146138
|
+
};
|
|
146139
|
+
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
146140
|
+
const { createConnection: createConnection2 } = await import("mysql2");
|
|
146141
|
+
let startAt = 0n;
|
|
146142
|
+
let tcpConnectedAt = 0n;
|
|
146143
|
+
let tlsConnectedAt = null;
|
|
146108
146144
|
const createStream = ({ config }) => {
|
|
146109
146145
|
let stream;
|
|
146110
146146
|
if (config.socketPath) {
|
|
@@ -146124,8 +146160,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146124
146160
|
return stream;
|
|
146125
146161
|
};
|
|
146126
146162
|
startAt = process.hrtime.bigint();
|
|
146127
|
-
const
|
|
146128
|
-
// debug: true,
|
|
146163
|
+
const connection2 = result2.url ? createConnection2({
|
|
146129
146164
|
uri: result2.url,
|
|
146130
146165
|
stream: createStream
|
|
146131
146166
|
}) : createConnection2({
|
|
@@ -146133,7 +146168,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146133
146168
|
stream: createStream
|
|
146134
146169
|
});
|
|
146135
146170
|
await new Promise((resolve2, reject) => {
|
|
146136
|
-
|
|
146171
|
+
connection2.connect((err2) => {
|
|
146137
146172
|
tlsConnectedAt = process.hrtime.bigint();
|
|
146138
146173
|
if (err2) {
|
|
146139
146174
|
reject(err2);
|
|
@@ -146142,48 +146177,19 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
146142
146177
|
}
|
|
146143
146178
|
});
|
|
146144
146179
|
});
|
|
146145
|
-
|
|
146146
|
-
|
|
146147
|
-
const
|
|
146148
|
-
|
|
146149
|
-
|
|
146150
|
-
|
|
146151
|
-
// rowsAsArray: true,
|
|
146152
|
-
});
|
|
146153
|
-
query2.on("error", (err2) => {
|
|
146154
|
-
reject(err2);
|
|
146155
|
-
});
|
|
146156
|
-
query2.on("fields", (fields) => {
|
|
146157
|
-
if (firstDataAt === 0n) {
|
|
146158
|
-
firstDataAt = process.hrtime.bigint();
|
|
146159
|
-
}
|
|
146160
|
-
bytesReceived += fields[0]._buf.length;
|
|
146161
|
-
});
|
|
146162
|
-
query2.on("end", () => {
|
|
146163
|
-
lastDataAt = process.hrtime.bigint();
|
|
146164
|
-
resolve2();
|
|
146165
|
-
newConnection.end();
|
|
146166
|
-
});
|
|
146167
|
-
});
|
|
146180
|
+
const results = [];
|
|
146181
|
+
for (let i7 = 0; i7 < repeats; i7++) {
|
|
146182
|
+
const r7 = await benchmarkQuery(connection2, sql, params);
|
|
146183
|
+
results.push(r7);
|
|
146184
|
+
}
|
|
146185
|
+
connection2.end();
|
|
146168
146186
|
return {
|
|
146169
146187
|
tcpHandshake: ms(startAt, tcpConnectedAt),
|
|
146170
146188
|
tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
|
|
146171
146189
|
dbHandshake: null,
|
|
146172
|
-
|
|
146173
|
-
execution: executionTime,
|
|
146174
|
-
dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
|
|
146175
|
-
total: ms(startAt, lastDataAt),
|
|
146176
|
-
dataSize: bytesReceived
|
|
146190
|
+
queries: results
|
|
146177
146191
|
};
|
|
146178
146192
|
};
|
|
146179
|
-
const benchmarkProxy = async ({ sql, params }, repeats) => {
|
|
146180
|
-
const results = [];
|
|
146181
|
-
for (let i7 = 0; i7 < repeats; i7++) {
|
|
146182
|
-
const r7 = await benchmarkQuery(sql, params);
|
|
146183
|
-
results.push(r7);
|
|
146184
|
-
}
|
|
146185
|
-
return results;
|
|
146186
|
-
};
|
|
146187
146193
|
return {
|
|
146188
146194
|
db: { query },
|
|
146189
146195
|
packageName: "mysql2",
|
package/api-sqlite.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-sqlite.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",
|