Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(d1): allow custom max_bind_values #4798

Closed
wants to merge 1 commit into from
Closed

Conversation

Weakky
Copy link
Contributor

@Weakky Weakky commented Mar 28, 2024

Overview

do not merge yet

Copy link
Contributor

github-actions bot commented Mar 28, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.138MiB 2.137MiB 1.327KiB
Postgres (gzip) 841.462KiB 840.814KiB 664.000B
Mysql 2.108MiB 2.107MiB 1.283KiB
Mysql (gzip) 828.527KiB 827.981KiB 559.000B
Sqlite 1.998MiB 1.998MiB -307.000B
Sqlite (gzip) 787.276KiB 787.578KiB -309.000B

Copy link

codspeed-hq bot commented Mar 28, 2024

CodSpeed Performance Report

Merging #4798 will not alter performance

Comparing d1/custom-max-bind-values (824d6e5) with main (264f24c)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

github-actions bot commented Mar 28, 2024

✅ WASM query-engine performance won't change substantially (1.004x)

Full benchmark report
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/bench?schema=imdb_bench&sslmode=disable" \
node --experimental-wasm-modules query-engine/driver-adapters/executor/dist/bench.mjs
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
cpu: AMD EPYC 7763 64-Core Processor
runtime: node v18.20.2 (x64-linux)

benchmark                   time (avg)             (min … max)       p75       p99      p999
-------------------------------------------------------------- -----------------------------
• movies.findMany() (all - ~50K)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     364 ms/iter       (361 ms … 369 ms)    369 ms    369 ms    369 ms
Web Assembly: Latest       448 ms/iter       (447 ms … 449 ms)    449 ms    449 ms    449 ms
Web Assembly: Current      450 ms/iter       (447 ms … 456 ms)    455 ms    456 ms    456 ms
Node API: Current          197 ms/iter       (194 ms … 207 ms)    198 ms    207 ms    207 ms

summary for movies.findMany() (all - ~50K)
  Web Assembly: Current
   2.28x slower than Node API: Current
   1.24x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  14'876 µs/iter (14'473 µs … 19'185 µs) 14'622 µs 19'185 µs 19'185 µs
Web Assembly: Latest    18'108 µs/iter (17'776 µs … 20'547 µs) 18'177 µs 20'547 µs 20'547 µs
Web Assembly: Current   18'228 µs/iter (18'024 µs … 19'006 µs) 18'273 µs 19'006 µs 19'006 µs
Node API: Current        7'917 µs/iter   (7'784 µs … 8'401 µs)  7'965 µs  8'401 µs  8'401 µs

summary for movies.findMany({ take: 2000 })
  Web Assembly: Current
   2.3x slower than Node API: Current
   1.23x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'291 µs/iter   (2'186 µs … 3'439 µs)  2'272 µs  3'301 µs  3'439 µs
Web Assembly: Latest     2'842 µs/iter   (2'752 µs … 3'577 µs)  2'832 µs  3'398 µs  3'577 µs
Web Assembly: Current    2'845 µs/iter   (2'769 µs … 3'843 µs)  2'840 µs  3'420 µs  3'843 µs
Node API: Current        1'383 µs/iter   (1'281 µs … 1'591 µs)  1'395 µs  1'585 µs  1'591 µs

summary for movies.findMany({ where: {...}, take: 2000 })
  Web Assembly: Current
   2.06x slower than Node API: Current
   1.24x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     583 ms/iter       (574 ms … 599 ms)    597 ms    599 ms    599 ms
Web Assembly: Latest       770 ms/iter       (762 ms … 801 ms)    776 ms    801 ms    801 ms
Web Assembly: Current      779 ms/iter       (770 ms … 797 ms)    794 ms    797 ms    797 ms
Node API: Current          459 ms/iter       (446 ms … 483 ms)    483 ms    483 ms    483 ms

summary for movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.7x slower than Node API: Current
   1.34x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  80'988 µs/iter (80'208 µs … 83'029 µs) 82'015 µs 83'029 µs 83'029 µs
Web Assembly: Latest       108 ms/iter       (108 ms … 109 ms)    108 ms    109 ms    109 ms
Web Assembly: Current      109 ms/iter       (109 ms … 109 ms)    109 ms    109 ms    109 ms
Node API: Current       60'443 µs/iter (59'653 µs … 61'324 µs) 61'228 µs 61'324 µs 61'324 µs

summary for movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.8x slower than Node API: Current
   1.35x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'024 ms/iter   (1'015 ms … 1'040 ms)  1'037 ms  1'040 ms  1'040 ms
Web Assembly: Latest     1'287 ms/iter   (1'278 ms … 1'302 ms)  1'300 ms  1'302 ms  1'302 ms
Web Assembly: Current    1'292 ms/iter   (1'280 ms … 1'302 ms)  1'301 ms  1'302 ms  1'302 ms
Node API: Current          866 ms/iter       (848 ms … 892 ms)    886 ms    892 ms    892 ms

summary for movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.49x slower than Node API: Current
   1.26x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     143 ms/iter       (142 ms … 144 ms)    143 ms    144 ms    144 ms
Web Assembly: Latest       180 ms/iter       (178 ms … 181 ms)    181 ms    181 ms    181 ms
Web Assembly: Current      180 ms/iter       (179 ms … 184 ms)    182 ms    184 ms    184 ms
Node API: Current          104 ms/iter       (103 ms … 106 ms)    106 ms    106 ms    106 ms

summary for movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.73x slower than Node API: Current
   1.26x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'045 µs/iter     (978 µs … 1'789 µs)  1'036 µs  1'705 µs  1'789 µs
Web Assembly: Latest     1'360 µs/iter   (1'298 µs … 1'998 µs)  1'362 µs  1'842 µs  1'998 µs
Web Assembly: Current    1'369 µs/iter   (1'302 µs … 2'282 µs)  1'364 µs  1'996 µs  2'282 µs
Node API: Current          773 µs/iter     (714 µs … 1'061 µs)    784 µs    835 µs  1'061 µs

summary for movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
  Web Assembly: Current
   1.77x slower than Node API: Current
   1.31x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'019 µs/iter     (981 µs … 1'593 µs)  1'027 µs  1'290 µs  1'593 µs
Web Assembly: Latest     1'365 µs/iter   (1'299 µs … 2'256 µs)  1'364 µs  1'771 µs  2'256 µs
Web Assembly: Current    1'363 µs/iter   (1'307 µs … 1'919 µs)  1'365 µs  1'772 µs  1'919 µs
Node API: Current          803 µs/iter     (749 µs … 1'390 µs)    804 µs  1'169 µs  1'390 µs

summary for movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
  Web Assembly: Current
   1.7x slower than Node API: Current
   1.34x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

After changes in 824d6e5

@@ -2,5 +2,6 @@
"connector": "sqlite",
"version": "cfd1",
"driver_adapter": "d1",
"external_test_executor": "Wasm"
"external_test_executor": "Wasm",
"driver_adapter_max_bind_value": 100
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency:

Suggested change
"driver_adapter_max_bind_value": 100
"driver_adapter_max_bind_values": 100

@jkomyno
Copy link
Contributor

jkomyno commented May 20, 2024

This PR can be closed via: #4878

@Jolg42
Copy link
Contributor

Jolg42 commented May 22, 2024

Replaced by #4878

@Jolg42 Jolg42 closed this May 22, 2024
@Jolg42 Jolg42 deleted the d1/custom-max-bind-values branch May 22, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants