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(schema-engine): fix sqlite migrations on D1 #4871

Merged
merged 4 commits into from
May 28, 2024

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented May 16, 2024

This PR:

Context: Slack.

/integration

@jkomyno jkomyno self-assigned this May 16, 2024
@jkomyno jkomyno added this to the 5.15.0 milestone May 16, 2024
Copy link
Contributor

github-actions bot commented May 16, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.041MiB 2.041MiB 0.000B
Postgres (gzip) 813.273KiB 813.274KiB -1.000B
Mysql 2.011MiB 2.011MiB 0.000B
Mysql (gzip) 799.903KiB 799.906KiB -3.000B
Sqlite 1.914MiB 1.914MiB 0.000B
Sqlite (gzip) 762.655KiB 762.658KiB -3.000B

Copy link

codspeed-hq bot commented May 16, 2024

CodSpeed Performance Report

Merging #4871 will not alter performance

Comparing integration/fix-sqlite-d1-migrations (9cebc28) with main (009080f)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

github-actions bot commented May 16, 2024

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

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.3 (x64-linux)

benchmark                   time (avg)             (min … max)       p75       p99      p999
-------------------------------------------------------------- -----------------------------
• movies.findMany() (all - ~50K)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     371 ms/iter       (367 ms … 376 ms)    375 ms    376 ms    376 ms
Web Assembly: Latest       466 ms/iter       (463 ms … 471 ms)    471 ms    471 ms    471 ms
Web Assembly: Current      466 ms/iter       (463 ms … 472 ms)    471 ms    472 ms    472 ms
Node API: Current          207 ms/iter       (199 ms … 215 ms)    215 ms    215 ms    215 ms

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

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  14'786 µs/iter (14'551 µs … 16'786 µs) 14'756 µs 16'786 µs 16'786 µs
Web Assembly: Latest    18'783 µs/iter (18'346 µs … 20'812 µs) 18'916 µs 20'812 µs 20'812 µs
Web Assembly: Current   18'783 µs/iter (18'612 µs … 19'151 µs) 18'837 µs 19'151 µs 19'151 µs
Node API: Current        8'199 µs/iter   (7'921 µs … 8'657 µs)  8'375 µs  8'657 µs  8'657 µs

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

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'313 µs/iter   (2'195 µs … 4'075 µs)  2'288 µs  3'470 µs  4'075 µs
Web Assembly: Latest     2'965 µs/iter   (2'819 µs … 5'051 µs)  2'904 µs  4'897 µs  5'051 µs
Web Assembly: Current    2'940 µs/iter   (2'826 µs … 3'643 µs)  2'922 µs  3'616 µs  3'643 µs
Node API: Current        1'422 µs/iter   (1'315 µs … 1'737 µs)  1'422 µs  1'722 µs  1'737 µs

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

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     579 ms/iter       (571 ms … 599 ms)    584 ms    599 ms    599 ms
Web Assembly: Latest       774 ms/iter       (770 ms … 780 ms)    780 ms    780 ms    780 ms
Web Assembly: Current      782 ms/iter       (775 ms … 798 ms)    786 ms    798 ms    798 ms
Node API: Current          478 ms/iter       (468 ms … 498 ms)    489 ms    498 ms    498 ms

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

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  79'699 µs/iter (79'166 µs … 80'226 µs) 80'211 µs 80'226 µs 80'226 µs
Web Assembly: Latest       110 ms/iter       (109 ms … 112 ms)    110 ms    112 ms    112 ms
Web Assembly: Current      110 ms/iter       (109 ms … 111 ms)    111 ms    111 ms    111 ms
Node API: Current       63'458 µs/iter (61'890 µs … 64'885 µs) 64'556 µs 64'885 µs 64'885 µs

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

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'019 ms/iter   (1'011 ms … 1'035 ms)  1'031 ms  1'035 ms  1'035 ms
Web Assembly: Latest     1'296 ms/iter   (1'286 ms … 1'314 ms)  1'310 ms  1'314 ms  1'314 ms
Web Assembly: Current    1'291 ms/iter   (1'285 ms … 1'302 ms)  1'295 ms  1'302 ms  1'302 ms
Node API: Current          883 ms/iter       (861 ms … 901 ms)    896 ms    901 ms    901 ms

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

• movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     147 ms/iter       (146 ms … 149 ms)    148 ms    149 ms    149 ms
Web Assembly: Latest       185 ms/iter       (184 ms … 188 ms)    186 ms    188 ms    188 ms
Web Assembly: Current      184 ms/iter       (183 ms … 189 ms)    185 ms    189 ms    189 ms
Node API: Current          109 ms/iter       (108 ms … 111 ms)    111 ms    111 ms    111 ms

summary for movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.69x slower than Node API: Current
   1.25x 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'018 µs/iter     (975 µs … 1'746 µs)  1'023 µs  1'495 µs  1'746 µs
Web Assembly: Latest     1'406 µs/iter   (1'326 µs … 2'216 µs)  1'399 µs  1'940 µs  2'216 µs
Web Assembly: Current    1'406 µs/iter   (1'336 µs … 2'294 µs)  1'407 µs  1'819 µs  2'294 µs
Node API: Current          771 µs/iter     (711 µs … 1'239 µs)    795 µs    843 µs  1'239 µs

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

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'029 µs/iter     (986 µs … 1'716 µs)  1'028 µs  1'607 µs  1'716 µs
Web Assembly: Latest     1'385 µs/iter   (1'328 µs … 1'894 µs)  1'390 µs  1'720 µs  1'894 µs
Web Assembly: Current    1'389 µs/iter   (1'338 µs … 1'745 µs)  1'398 µs  1'705 µs  1'745 µs
Node API: Current          779 µs/iter     (711 µs … 1'194 µs)    802 µs    845 µs  1'194 µs

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

After changes in 9cebc28

@jkomyno jkomyno marked this pull request as ready for review May 28, 2024 09:16
@jkomyno jkomyno requested a review from a team as a code owner May 28, 2024 09:16
@jkomyno jkomyno requested review from Druue and removed request for a team May 28, 2024 09:16
@jkomyno
Copy link
Contributor Author

jkomyno commented May 28, 2024

Last time, Neon was failing due to unrelated PRs in the main pipeline.
I'm merging this, so that we can later proceed with prisma/prisma#24214.

@jkomyno jkomyno merged commit cb3b66c into main May 28, 2024
210 of 211 checks passed
@jkomyno jkomyno deleted the integration/fix-sqlite-d1-migrations branch May 28, 2024 09:24
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.

Bug: Migrations not compatible with D1
1 participant