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(introspection, sqlserver): Accept (and ignore) multi-line shared defaults #4884

Merged
merged 3 commits into from
May 24, 2024

Conversation

janpio
Copy link
Member

@janpio janpio commented May 23, 2024

DEFAULT_SHARED_CONSTRAINT was previously limited to only match if the string started with CREATE DEFAULT, but we learned that there can be other characters before that, including newlines.

closes prisma/prisma#24275

Copy link

codspeed-hq bot commented May 23, 2024

CodSpeed Performance Report

Merging #4884 will not alter performance

Comparing janpio/24275 (d462110) with main (b4fe3e6)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

github-actions bot commented May 23, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.153MiB 2.153MiB 0.000B
Postgres (gzip) 846.058KiB 846.058KiB 0.000B
Mysql 2.119MiB 2.119MiB 0.000B
Mysql (gzip) 831.746KiB 831.748KiB -2.000B
Sqlite 2.015MiB 2.015MiB 0.000B
Sqlite (gzip) 793.078KiB 793.078KiB 0.000B

Copy link
Contributor

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

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     370 ms/iter       (364 ms … 379 ms)    371 ms    379 ms    379 ms
Web Assembly: Latest       451 ms/iter       (446 ms … 466 ms)    453 ms    466 ms    466 ms
Web Assembly: Current      452 ms/iter       (448 ms … 454 ms)    453 ms    454 ms    454 ms
Node API: Current          196 ms/iter       (191 ms … 201 ms)    201 ms    201 ms    201 ms

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

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  14'905 µs/iter (14'603 µs … 17'815 µs) 14'782 µs 17'815 µs 17'815 µs
Web Assembly: Latest    18'360 µs/iter (18'143 µs … 18'698 µs) 18'417 µs 18'698 µs 18'698 µs
Web Assembly: Current   18'289 µs/iter (18'135 µs … 19'495 µs) 18'301 µs 19'495 µs 19'495 µs
Node API: Current        7'932 µs/iter   (7'795 µs … 8'316 µs)  7'960 µs  8'316 µs  8'316 µs

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

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'318 µs/iter   (2'194 µs … 3'656 µs)  2'278 µs  3'541 µs  3'656 µs
Web Assembly: Latest     2'810 µs/iter   (2'741 µs … 3'445 µs)  2'817 µs  3'136 µs  3'445 µs
Web Assembly: Current    2'869 µs/iter   (2'759 µs … 4'721 µs)  2'850 µs  3'564 µs  4'721 µs
Node API: Current        1'377 µs/iter   (1'291 µs … 1'593 µs)  1'392 µs  1'568 µs  1'593 µs

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

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     568 ms/iter       (559 ms … 583 ms)    582 ms    583 ms    583 ms
Web Assembly: Latest       770 ms/iter       (764 ms … 786 ms)    775 ms    786 ms    786 ms
Web Assembly: Current      773 ms/iter       (767 ms … 784 ms)    779 ms    784 ms    784 ms
Node API: Current          454 ms/iter       (444 ms … 473 ms)    457 ms    473 ms    473 ms

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

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  78'921 µs/iter (78'410 µs … 81'175 µs) 79'229 µs 81'175 µs 81'175 µs
Web Assembly: Latest       109 ms/iter       (108 ms … 113 ms)    109 ms    113 ms    113 ms
Web Assembly: Current      109 ms/iter       (108 ms … 109 ms)    109 ms    109 ms    109 ms
Node API: Current       60'391 µs/iter (59'584 µs … 61'116 µs) 60'848 µs 61'116 µs 61'116 µs

summary for movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.8x 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'011 ms/iter   (1'001 ms … 1'026 ms)  1'022 ms  1'026 ms  1'026 ms
Web Assembly: Latest     1'295 ms/iter   (1'286 ms … 1'308 ms)  1'305 ms  1'308 ms  1'308 ms
Web Assembly: Current    1'297 ms/iter   (1'290 ms … 1'310 ms)  1'303 ms  1'310 ms  1'310 ms
Node API: Current          869 ms/iter       (850 ms … 897 ms)    885 ms    897 ms    897 ms

summary for movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.49x slower than Node API: Current
   1.28x 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       (145 ms … 150 ms)    149 ms    150 ms    150 ms
Web Assembly: Latest       184 ms/iter       (182 ms … 188 ms)    185 ms    188 ms    188 ms
Web Assembly: Current      182 ms/iter       (179 ms … 192 ms)    186 ms    192 ms    192 ms
Node API: Current          107 ms/iter       (103 ms … 114 ms)    108 ms    114 ms    114 ms

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

• movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'037 µs/iter     (979 µs … 1'702 µs)  1'035 µs  1'509 µs  1'702 µs
Web Assembly: Latest     1'362 µs/iter   (1'301 µs … 2'157 µs)  1'358 µs  1'875 µs  2'157 µs
Web Assembly: Current    1'366 µs/iter   (1'301 µs … 2'153 µs)  1'368 µs  1'769 µs  2'153 µs
Node API: Current          771 µs/iter     (732 µs … 1'033 µs)    785 µs    890 µs  1'033 µ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.32x 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'022 µs/iter     (984 µs … 1'459 µs)  1'028 µs  1'313 µs  1'459 µs
Web Assembly: Latest     1'446 µs/iter   (1'328 µs … 2'586 µs)  1'394 µs  2'540 µs  2'586 µs
Web Assembly: Current    1'383 µs/iter   (1'331 µs … 1'996 µs)  1'384 µs  1'783 µs  1'996 µs
Node API: Current          768 µs/iter     (708 µs … 1'042 µs)    784 µs    906 µs  1'042 µs

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

After changes in d462110

@janpio janpio modified the milestone: 5.15.0 May 23, 2024
@janpio janpio marked this pull request as ready for review May 23, 2024 23:40
@janpio janpio requested a review from a team as a code owner May 23, 2024 23:40
@janpio janpio requested review from Druue and removed request for a team May 23, 2024 23:40
Copy link
Contributor

@Druue Druue left a comment

Choose a reason for hiding this comment

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

Nice!

api.raw_cmd(&format!(
r#"
/* This is a comment */
CREATE DEFAULT [{schema}].dogdog AS 'mugi'
Copy link
Contributor

Choose a reason for hiding this comment

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

🐶

@Druue Druue merged commit 417c14e into main May 24, 2024
207 checks passed
@Druue Druue deleted the janpio/24275 branch May 24, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment