kysely-postgrejs 1.2.0 โ 1.2.1
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/CHANGELOG.md +14 -1
- package/README.md +40 -40
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
<!-- rman:documented-up-to
|
|
3
|
+
<!-- rman:documented-up-to b60cfe166e126812c607076709c441756040d4ce -->
|
|
4
|
+
|
|
5
|
+
## v1.2.1 (2026-10-06)
|
|
6
|
+
|
|
7
|
+
### ๐งน Chores
|
|
8
|
+
|
|
9
|
+
- sync lockfile (1cc575b)
|
|
10
|
+
|
|
11
|
+
### ๐ฌ General Changes
|
|
12
|
+
|
|
13
|
+
- say that the 4MB write's clock is mostly PostgreSQL (c6ace54)
|
|
14
|
+
- stop billing PostgreJS for a feature pg does not have (85c175b)
|
|
15
|
+
|
|
16
|
+
---
|
|
4
17
|
|
|
5
18
|
## v1.2.0 (2026-10-05)
|
|
6
19
|
|
package/README.md
CHANGED
|
@@ -11,11 +11,11 @@ types, your queries, your migrations.
|
|
|
11
11
|
|
|
12
12
|
<!-- bench:intro -->
|
|
13
13
|
|
|
14
|
-
It is faster where it counts, and it allocates far less doing it. A 4 MB `bytea` comes back in 15.
|
|
15
|
-
ms against
|
|
16
|
-
size, off the JS heap where a heap figure alone cannot see it. A 100k-element `int4[]` runs 3.
|
|
17
|
-
2.2 MB against 22.
|
|
18
|
-
faster of the two in
|
|
14
|
+
It is faster where it counts, and it allocates far less doing it. A 4 MB `bytea` comes back in 15.8
|
|
15
|
+
ms against 37.2 ms, on 4.1 MB a call against 51.6 MB - `pg` reads that column as hex text, twice the
|
|
16
|
+
size, off the JS heap where a heap figure alone cannot see it. A 100k-element `int4[]` runs 3.9x, on
|
|
17
|
+
2.2 MB against 22.9 MB. Ordinary queries gain less and gain it repeatably: a point read is the
|
|
18
|
+
faster of the two in 100 of 101 alternated pairs. All of it measured through Kysely against Kysely's
|
|
19
19
|
own `PostgresDialect` over `pg`, on the same server: [`doc/BENCHMARKS.md`](doc/BENCHMARKS.md).
|
|
20
20
|
|
|
21
21
|
<!-- /bench:intro -->
|
|
@@ -183,7 +183,7 @@ the same schema types, the same queries, the same migrations. What you get for i
|
|
|
183
183
|
|
|
184
184
|
<!-- bench:payload -->
|
|
185
185
|
|
|
186
|
-
- **Faster where the payload is large** - 2.
|
|
186
|
+
- **Faster where the payload is large** - 2.4x on a 4 MB `bytea` and 3.9x on a 100k-element
|
|
187
187
|
`int4[]`, on a fraction of the memory, because the values arrive in PostgreSQL's binary format
|
|
188
188
|
rather than as text to be parsed.
|
|
189
189
|
|
|
@@ -200,23 +200,23 @@ the same schema types, the same queries, the same migrations. What you get for i
|
|
|
200
200
|
|
|
201
201
|
| Scenario | node-postgres<br>allocated per call | postgrejs<br>allocated per call | |
|
|
202
202
|
| ------------------------------------------------------------------------------------------------------ | ----------------------------------- | -------------------------------- | --------------------- |
|
|
203
|
-
| point read - 1 row of 9 columns | 0.
|
|
204
|
-
| point read through the builder - the same row, selected with selectFrom().where() instead of a sql tag | 0.
|
|
205
|
-
| page of 200 - 200 rows of 9 columns, mixed types |
|
|
206
|
-
| concurrent reads - 20 reads at once of 1 row each, pool of 10 | 1.
|
|
207
|
-
| int4[] of 100k, full width - 1 row holding 1 array of 100 000 values that use the whole type |
|
|
208
|
-
| float8 of 5k rows, full width - 5000 rows of 1 value, eight bytes against seventeen significant digits | 1.
|
|
209
|
-
| float8[] of 5k in one row - 1 row holding 1 array of the same 5000 values | 2.
|
|
210
|
-
| uuid of 5k rows - 5000 rows of 1 value, sixteen bytes against thirty-six characters | 1.
|
|
211
|
-
| box of 5k rows - 5000 rows of 1 value, four float8s against coordinates that use them | 2.
|
|
212
|
-
| bytea of 4MB - 1 row holding 1 value of 4 MB |
|
|
213
|
-
| insert one row - 1 row, six parameters | 0.
|
|
214
|
-
| insert 500 rows - 500 rows in 1 statement, 2500 parameters that fill their types | 4.
|
|
215
|
-
| insert a 4MB bytea - 1 row holding 1 value of 4 MB
|
|
216
|
-
| insert a 100k int4[] - 1 row holding 1 array of 100 000 values, text on both sides |
|
|
217
|
-
| twenty inserts in a transaction - 20 rows, one statement each, inside one transaction |
|
|
218
|
-
|
|
219
|
-
`kysely` 0.29.6, `postgrejs` 3.
|
|
203
|
+
| point read - 1 row of 9 columns | 0.288 ms<br>**26 KB**/call | **0.251 ms**<br>28 KB/call | **1.15x**<br>+8% |
|
|
204
|
+
| point read through the builder - the same row, selected with selectFrom().where() instead of a sql tag | 0.288 ms<br>**28 KB**/call | **0.252 ms**<br>30 KB/call | **1.15x**<br>+8% |
|
|
205
|
+
| page of 200 - 200 rows of 9 columns, mixed types | 0.656 ms<br>471 KB/call | **0.531 ms**<br>**339 KB**/call | **1.24x**<br>**-28%** |
|
|
206
|
+
| concurrent reads - 20 reads at once of 1 row each, pool of 10 | 1.164 ms<br>**420 KB**/call | **1.054 ms**<br>464 KB/call | **1.10x**<br>+11% |
|
|
207
|
+
| int4[] of 100k, full width - 1 row holding 1 array of 100 000 values that use the whole type | 21.859 ms<br>22.9 MB/call | **5.545 ms**<br>**2.2 MB**/call | **3.94x**<br>**-90%** |
|
|
208
|
+
| float8 of 5k rows, full width - 5000 rows of 1 value, eight bytes against seventeen significant digits | 1.194 ms<br>1.4 MB/call | **0.822 ms**<br>**1.2 MB**/call | **1.45x**<br>**-13%** |
|
|
209
|
+
| float8[] of 5k in one row - 1 row holding 1 array of the same 5000 values | 2.240 ms<br>2.8 MB/call | **0.612 ms**<br>**226 KB**/call | **3.66x**<br>**-92%** |
|
|
210
|
+
| uuid of 5k rows - 5000 rows of 1 value, sixteen bytes against thirty-six characters | 1.294 ms<br>1.5 MB/call | **0.950 ms**<br>1.5 MB/call | **1.36x**<br>level |
|
|
211
|
+
| box of 5k rows - 5000 rows of 1 value, four float8s against coordinates that use them | 2.161 ms<br>1.9 MB/call | **1.219 ms**<br>**1.9 MB**/call | **1.77x**<br>**-2%** |
|
|
212
|
+
| bytea of 4MB - 1 row holding 1 value of 4 MB | 37.207 ms<br>51.6 MB/call | **15.819 ms**<br>**4.1 MB**/call | **2.35x**<br>**-92%** |
|
|
213
|
+
| insert one row - 1 row, six parameters | 0.314 ms<br>**22 KB**/call | **0.273 ms**<br>27 KB/call | **1.15x**<br>+22% |
|
|
214
|
+
| insert 500 rows - 500 rows in 1 statement, 2500 parameters that fill their types | 4.398 ms<br>**1.3 MB**/call | 4.309 ms<br>1.4 MB/call | level<br>+7% |
|
|
215
|
+
| insert a 4MB bytea - 1 row holding 1 value of 4 MB - the clock is mostly the server | 17.322 ms<br>**2.6 MB**/call | **15.038 ms**<br>2.7 MB/call | **1.15x**<br>+3% |
|
|
216
|
+
| insert a 100k int4[] - 1 row holding 1 array of 100 000 values, text on both sides | 17.951 ms<br>27.2 MB/call | **12.847 ms**<br>**993 KB**/call | **1.40x**<br>**-96%** |
|
|
217
|
+
| twenty inserts in a transaction - 20 rows, one statement each, inside one transaction | 5.610 ms<br>**276 KB**/call | **4.901 ms**<br>362 KB/call | **1.14x**<br>+31% |
|
|
218
|
+
|
|
219
|
+
`kysely` 0.29.6, `postgrejs` 3.13.0, `pg` 8.23.1, PostgreSQL on loopback, Node 24.15.0. Medians; how
|
|
220
220
|
that was measured and how much each row can bear are in [How the numbers were
|
|
221
221
|
measured](#how-the-numbers-were-measured).
|
|
222
222
|
|
|
@@ -240,21 +240,21 @@ What does not drift is _which_ of the two won each pair, so that is counted sepa
|
|
|
240
240
|
|
|
241
241
|
| Scenario | pairs | postgrejs faster in | odds of that by luck |
|
|
242
242
|
| ------------------------------- | ----- | ------------------- | -------------------- |
|
|
243
|
-
| point read | 101 |
|
|
244
|
-
| point read through the builder | 101 |
|
|
245
|
-
| page of 200 | 101 |
|
|
246
|
-
| concurrent reads | 61 |
|
|
243
|
+
| point read | 101 | 100 | < 1 in 10^28 |
|
|
244
|
+
| point read through the builder | 101 | 100 | < 1 in 10^28 |
|
|
245
|
+
| page of 200 | 101 | 93 | < 1 in 10^18 |
|
|
246
|
+
| concurrent reads | 61 | 41 | p = 0.010 |
|
|
247
247
|
| int4[] of 100k, full width | 41 | 41 | < 1 in 10^12 |
|
|
248
|
-
| float8 of 5k rows, full width | 61 |
|
|
248
|
+
| float8 of 5k rows, full width | 61 | 61 | < 1 in 10^18 |
|
|
249
249
|
| float8[] of 5k in one row | 61 | 61 | < 1 in 10^18 |
|
|
250
|
-
| uuid of 5k rows | 61 |
|
|
250
|
+
| uuid of 5k rows | 61 | 57 | < 1 in 10^12 |
|
|
251
251
|
| box of 5k rows | 61 | 61 | < 1 in 10^18 |
|
|
252
252
|
| bytea of 4MB | 41 | 41 | < 1 in 10^12 |
|
|
253
|
-
| insert one row | 101 |
|
|
254
|
-
| insert 500 rows | 61 |
|
|
255
|
-
| insert a 4MB bytea | 41 |
|
|
256
|
-
| insert a 100k int4[] | 41 |
|
|
257
|
-
| twenty inserts in a transaction | 61 |
|
|
253
|
+
| insert one row | 101 | 98 | < 1 in 10^24 |
|
|
254
|
+
| insert 500 rows | 61 | 38 | not distinguishable |
|
|
255
|
+
| insert a 4MB bytea | 41 | 40 | < 1 in 10^10 |
|
|
256
|
+
| insert a 100k int4[] | 41 | 41 | < 1 in 10^12 |
|
|
257
|
+
| twenty inserts in a transaction | 61 | 59 | < 1 in 10^14 |
|
|
258
258
|
|
|
259
259
|
<!-- /bench:signtest -->
|
|
260
260
|
|
|
@@ -267,8 +267,8 @@ split a coin would produce is printed as level rather than rounded into a win.
|
|
|
267
267
|
<!-- bench:binary -->
|
|
268
268
|
|
|
269
269
|
Result columns arrive in PostgreSQL's binary format and are decoded per type, where `pg` asks for
|
|
270
|
-
text and parses it. On bulk that is the whole difference: a 100k-element `int4[]` costs
|
|
271
|
-
2.2 MB here against
|
|
270
|
+
text and parses it. On bulk that is the whole difference: a 100k-element `int4[]` costs 5.5 ms and
|
|
271
|
+
2.2 MB here against 21.9 ms and 22.9 MB, because the text path has to materialise the array literal
|
|
272
272
|
as one string before it can parse it.
|
|
273
273
|
|
|
274
274
|
<!-- /bench:binary -->
|
|
@@ -278,16 +278,16 @@ as one string before it can parse it.
|
|
|
278
278
|
PostgreJS names and caches a statement per connection - 64 by default, least-recently-used closed -
|
|
279
279
|
so each distinct SQL string is parsed and planned once rather than on every call. `pg` prepares only
|
|
280
280
|
a query it was given a name for, and Kysely does not give it one, so the same statement is parsed
|
|
281
|
-
again on every call there. That is what the point read's
|
|
281
|
+
again on every call there. That is what the point read's 100 pairs of 101 is made of.
|
|
282
282
|
|
|
283
283
|
<!-- /bench:prepared -->
|
|
284
284
|
|
|
285
285
|
<!-- bench:builder -->
|
|
286
286
|
|
|
287
|
-
The query builder itself costs
|
|
287
|
+
The query builder itself costs 1.7 KB a call over a `sql` tag here and 1.6 KB on `pg`, and nothing
|
|
288
288
|
that separates from drift on the clock - Kysely's own compiler runs on both sides, so it is the same
|
|
289
|
-
work paid once per driver rather than a difference between them. The same read is 1.
|
|
290
|
-
tag and 1.
|
|
289
|
+
work paid once per driver rather than a difference between them. The same read is 1.15x through the
|
|
290
|
+
tag and 1.15x through the builder.
|
|
291
291
|
|
|
292
292
|
<!-- /bench:builder -->
|
|
293
293
|
|
package/package.json
CHANGED