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(se): Drift when FKs have same columns #4885

Merged
merged 4 commits into from
May 31, 2024
Merged

fix(se): Drift when FKs have same columns #4885

merged 4 commits into from
May 31, 2024

Conversation

Druue
Copy link
Contributor

@Druue Druue commented May 24, 2024

fixes prisma/prisma#23043

based on #1904

@Druue Druue added this to the 5.15.0 milestone May 24, 2024
@Druue Druue requested a review from a team as a code owner May 24, 2024 13:43
@Druue Druue requested review from jkomyno and removed request for a team May 24, 2024 13:43
Copy link

codspeed-hq bot commented May 24, 2024

CodSpeed Performance Report

Merging #4885 will not alter performance

Comparing fix/23043 (d62b294) with main (64bb6b9)

Summary

✅ 11 untouched benchmarks

Copy link
Contributor

github-actions bot commented May 24, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.041MiB 2.041MiB 0.000B
Postgres (gzip) 813.642KiB 813.642KiB 0.000B
Mysql 2.011MiB 2.011MiB 0.000B
Mysql (gzip) 800.059KiB 800.059KiB 0.000B
Sqlite 1.914MiB 1.914MiB 0.000B
Sqlite (gzip) 762.784KiB 762.784KiB 0.000B

Copy link
Contributor

github-actions bot commented May 27, 2024

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

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       (367 ms … 374 ms)    372 ms    374 ms    374 ms
Web Assembly: Latest       465 ms/iter       (462 ms … 472 ms)    472 ms    472 ms    472 ms
Web Assembly: Current      464 ms/iter       (459 ms … 472 ms)    470 ms    472 ms    472 ms
Node API: Current          197 ms/iter       (194 ms … 201 ms)    199 ms    201 ms    201 ms

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

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  15'247 µs/iter (14'743 µs … 17'805 µs) 15'149 µs 17'805 µs 17'805 µs
Web Assembly: Latest    19'113 µs/iter (18'764 µs … 20'582 µs) 19'149 µs 20'582 µs 20'582 µs
Web Assembly: Current   18'918 µs/iter (18'571 µs … 20'047 µs) 19'022 µs 20'047 µs 20'047 µs
Node API: Current        8'375 µs/iter  (7'922 µs … 12'432 µs)  8'322 µs 12'432 µs 12'432 µs

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

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'312 µs/iter   (2'204 µs … 3'402 µs)  2'294 µs  3'284 µs  3'402 µs
Web Assembly: Latest     2'916 µs/iter   (2'797 µs … 3'609 µs)  2'910 µs  3'332 µs  3'609 µs
Web Assembly: Current    2'916 µs/iter   (2'797 µs … 3'838 µs)  2'899 µs  3'474 µs  3'838 µs
Node API: Current        1'408 µs/iter   (1'287 µs … 1'838 µs)  1'416 µs  1'752 µs  1'838 µs

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

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     575 ms/iter       (565 ms … 592 ms)    586 ms    592 ms    592 ms
Web Assembly: Latest       789 ms/iter       (783 ms … 806 ms)    791 ms    806 ms    806 ms
Web Assembly: Current      782 ms/iter       (774 ms … 796 ms)    786 ms    796 ms    796 ms
Node API: Current          480 ms/iter       (464 ms … 495 ms)    493 ms    495 ms    495 ms

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

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  79'626 µs/iter (79'229 µs … 80'123 µs) 80'023 µs 80'123 µs 80'123 µs
Web Assembly: Latest       114 ms/iter       (112 ms … 121 ms)    114 ms    121 ms    121 ms
Web Assembly: Current      111 ms/iter       (111 ms … 111 ms)    111 ms    111 ms    111 ms
Node API: Current       64'510 µs/iter (63'676 µs … 65'240 µs) 65'012 µs 65'240 µs 65'240 µs

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

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'010 ms/iter   (1'003 ms … 1'029 ms)  1'014 ms  1'029 ms  1'029 ms
Web Assembly: Latest     1'308 ms/iter   (1'299 ms … 1'327 ms)  1'320 ms  1'327 ms  1'327 ms
Web Assembly: Current    1'292 ms/iter   (1'281 ms … 1'315 ms)  1'315 ms  1'315 ms  1'315 ms
Node API: Current          874 ms/iter       (860 ms … 897 ms)    892 ms    897 ms    897 ms

summary for movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.48x slower than Node API: Current
   1.28x slower than Web Assembly: Baseline
   1.01x 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)    147 ms    149 ms    149 ms
Web Assembly: Latest       188 ms/iter       (188 ms … 189 ms)    189 ms    189 ms    189 ms
Web Assembly: Current      185 ms/iter       (185 ms … 186 ms)    186 ms    186 ms    186 ms
Node API: Current          118 ms/iter       (115 ms … 125 ms)    119 ms    125 ms    125 ms

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

• movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'056 µs/iter     (972 µs … 1'777 µs)  1'049 µs  1'675 µs  1'777 µs
Web Assembly: Latest     1'423 µs/iter   (1'323 µs … 2'538 µs)  1'420 µs  2'048 µs  2'538 µs
Web Assembly: Current    1'486 µs/iter   (1'329 µs … 2'615 µs)  1'432 µs  2'584 µs  2'615 µs
Node API: Current          748 µs/iter     (688 µs … 1'172 µs)    777 µs    829 µs  1'172 µs

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

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'028 µs/iter     (978 µs … 1'725 µs)  1'032 µs  1'616 µs  1'725 µs
Web Assembly: Latest     1'389 µs/iter   (1'326 µs … 1'955 µs)  1'401 µs  1'666 µs  1'955 µs
Web Assembly: Current    1'411 µs/iter   (1'331 µs … 2'292 µs)  1'414 µs  2'172 µs  2'292 µs
Node API: Current          808 µs/iter     (741 µs … 1'359 µs)    818 µs  1'027 µs  1'359 µs

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

After changes in 2940594

@Druue Druue merged commit 9ee4383 into main May 31, 2024
207 checks passed
@Druue Druue deleted the fix/23043 branch May 31, 2024 01:48
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.

Foreign key relation results in erroneous second migration
2 participants