-
Notifications
You must be signed in to change notification settings - Fork 231
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
qe: fix pathological behaviour with many @unique
s
#4179
Conversation
CodSpeed Performance ReportMerging #4179 will not alter performanceComparing Summary
|
#[connector_test] | ||
async fn repro(runner: Runner) -> TestResult<()> { | ||
let query = r#" | ||
query { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsk tsk tsk, indoc!
plz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed ✔️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, hi Julius 👋🏻
6ac2e2d
to
1dcdccb
Compare
@unique
s
The quaint AST lets users keep track of unique index definitions in tables in order to generate `MERGE` statements in SQL Server. The SQL query connector diligently adds every unique index to the table definitions in the `AsTable` implementation for models. The concrete method used to add the indexes is `Table::add_unique_index()`. Its space complexity is `O(n!)` on the number of unique indexes on a model, which quickly leads to high memory usage, then hanging and out-of-memory errors. See the inline comment in the commit for more details on what happened exactly, and how this commit fixes the problem. The included regression test would consistently take multiple minutes, then OOM on a fast desktop machine with 32GB of RAM before the fix. closes prisma/prisma#20799
28a34d0
to
8e8ab87
Compare
The quaint AST lets users keep track of unique index definitions in
tables in order to generate
MERGE
statements in SQL Server.The SQL query connector diligently adds every unique index to the table
definitions in the
AsTable
implementation for models.The concrete method used to add the indexes is
Table::add_unique_index()
. Its space complexity isO(n!)
on thenumber of unique indexes on a model, which quickly leads to
high memory usage, then hanging and out-of-memory errors.
See the inline comment in the commit for more details on what happened
exactly, and how this commit fixes the problem. The included regression
test would consistently take multiple minutes, then OOM on a fast
desktop machine with 32GB of RAM before the fix.
closes prisma/prisma#20799