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

feat(psl): exclude unused "MultiSchema" capability in MySQL, simplify multiSchema tests #4866

Merged
merged 6 commits into from May 14, 2024

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented May 10, 2024

This PR closes https://github.com/prisma/team-orm/issues/996.

Note: a consequence of this PR is that, given a schema like

datasource testds {
    provider = "mysql"
    url = env("TEST_DATABASE_URL")
    schemas = ["public", "sphere"]
}

generator js {
    provider = "prisma-client-js"
    previewFeatures = ["multiSchema"]
}

model Test {
  id Int @id

  @@schema("public")
}

the following validation errors appears

The schemas property is not supported on the current connector.

Our documentation never mentioned that provider = "mysql" supported multiSchema (which in fact isn't supported by our Schema Engine and Query Engine), though it was accepted by psl and prisma validate.

@jkomyno jkomyno added this to the 5.14.0 milestone May 10, 2024
Copy link

codspeed-hq bot commented May 10, 2024

CodSpeed Performance Report

Merging #4866 will not alter performance

Comparing fix/remove-multiSchema-tag-on-mysql (6a52bc0) with main (079da82)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

github-actions bot commented May 10, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.153MiB 2.153MiB 0.000B
Postgres (gzip) 846.110KiB 846.112KiB -2.000B
Mysql 2.120MiB 2.121MiB -1.408KiB
Mysql (gzip) 831.956KiB 832.565KiB -624.000B
Sqlite 2.015MiB 2.015MiB 0.000B
Sqlite (gzip) 793.469KiB 793.469KiB 0.000B

Copy link
Contributor

github-actions bot commented May 10, 2024

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

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     362 ms/iter       (359 ms … 368 ms)    363 ms    368 ms    368 ms
Web Assembly: Latest       457 ms/iter       (452 ms … 466 ms)    462 ms    466 ms    466 ms
Web Assembly: Current      460 ms/iter       (455 ms … 467 ms)    465 ms    467 ms    467 ms
Node API: Current          197 ms/iter       (196 ms … 199 ms)    198 ms    199 ms    199 ms

summary for movies.findMany() (all - ~50K)
  Web Assembly: Current
   2.34x slower than Node API: Current
   1.27x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  14'699 µs/iter (14'380 µs … 16'842 µs) 14'530 µs 16'842 µs 16'842 µs
Web Assembly: Latest    18'511 µs/iter (18'044 µs … 21'623 µs) 18'506 µs 21'623 µs 21'623 µs
Web Assembly: Current   18'439 µs/iter (18'278 µs … 19'179 µs) 18'465 µs 19'179 µs 19'179 µs
Node API: Current        8'049 µs/iter   (7'859 µs … 8'331 µs)  8'106 µs  8'331 µs  8'331 µs

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

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'343 µs/iter   (2'215 µs … 3'560 µs)  2'321 µs  3'412 µs  3'560 µs
Web Assembly: Latest     2'881 µs/iter   (2'790 µs … 3'651 µs)  2'872 µs  3'329 µs  3'651 µs
Web Assembly: Current    2'873 µs/iter   (2'793 µs … 3'586 µs)  2'872 µs  3'325 µs  3'586 µs
Node API: Current        1'420 µs/iter   (1'336 µs … 1'840 µs)  1'421 µs  1'790 µs  1'840 µs

summary for movies.findMany({ where: {...}, take: 2000 })
  Web Assembly: Current
   2.02x slower than Node API: Current
   1.23x 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       (575 ms … 602 ms)    598 ms    602 ms    602 ms
Web Assembly: Latest       781 ms/iter       (779 ms … 788 ms)    784 ms    788 ms    788 ms
Web Assembly: Current      781 ms/iter       (775 ms … 798 ms)    783 ms    798 ms    798 ms
Node API: Current          480 ms/iter       (473 ms … 490 ms)    490 ms    490 ms    490 ms

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

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  80'661 µs/iter (80'236 µs … 81'255 µs) 81'099 µs 81'255 µs 81'255 µs
Web Assembly: Latest       110 ms/iter       (110 ms … 111 ms)    110 ms    111 ms    111 ms
Web Assembly: Current      109 ms/iter       (109 ms … 110 ms)    110 ms    110 ms    110 ms
Node API: Current       62'855 µs/iter (61'814 µs … 63'544 µs) 63'388 µs 63'544 µs 63'544 µs

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

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'018 ms/iter   (1'013 ms … 1'022 ms)  1'022 ms  1'022 ms  1'022 ms
Web Assembly: Latest     1'307 ms/iter   (1'296 ms … 1'330 ms)  1'324 ms  1'330 ms  1'330 ms
Web Assembly: Current    1'314 ms/iter   (1'301 ms … 1'355 ms)  1'332 ms  1'355 ms  1'355 ms
Node API: Current          889 ms/iter       (851 ms … 932 ms)    918 ms    932 ms    932 ms

summary for movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.48x slower than Node API: Current
   1.29x 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       (143 ms … 144 ms)    144 ms    144 ms    144 ms
Web Assembly: Latest       181 ms/iter       (180 ms … 182 ms)    182 ms    182 ms    182 ms
Web Assembly: Current      184 ms/iter       (181 ms … 191 ms)    190 ms    191 ms    191 ms
Node API: Current          109 ms/iter       (107 ms … 111 ms)    110 ms    111 ms    111 ms

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

• movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'029 µs/iter     (976 µs … 1'698 µs)  1'031 µs  1'456 µs  1'698 µs
Web Assembly: Latest     1'411 µs/iter   (1'336 µs … 2'227 µs)  1'396 µs  2'069 µs  2'227 µs
Web Assembly: Current    1'395 µs/iter   (1'344 µs … 1'866 µs)  1'398 µs  1'698 µs  1'866 µs
Node API: Current          774 µs/iter     (703 µs … 1'212 µs)    796 µs    897 µs  1'212 µs

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

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'033 µs/iter     (984 µs … 1'760 µs)  1'032 µs  1'421 µs  1'760 µs
Web Assembly: Latest     1'385 µs/iter   (1'312 µs … 2'149 µs)  1'380 µs  2'066 µs  2'149 µs
Web Assembly: Current    1'395 µs/iter   (1'321 µs … 2'406 µs)  1'388 µs  1'976 µs  2'406 µs
Node API: Current          799 µs/iter     (716 µs … 1'201 µs)    810 µs    854 µs  1'201 µs

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

After changes in 6a52bc0

@jkomyno jkomyno marked this pull request as ready for review May 10, 2024 20:39
@jkomyno jkomyno requested a review from a team as a code owner May 10, 2024 20:39
@jkomyno jkomyno requested review from laplab and removed request for a team and laplab May 10, 2024 20:39
@jkomyno jkomyno requested a review from SevInf May 13, 2024 09:51
@jkomyno jkomyno modified the milestones: 5.14.0, 5.15.0 May 13, 2024
@jkomyno jkomyno merged commit ae0473d into main May 14, 2024
207 checks passed
@jkomyno jkomyno deleted the fix/remove-multiSchema-tag-on-mysql branch May 14, 2024 16:45
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.

None yet

2 participants