Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upIs it possible to execute multiple UPDATES at once? #1517
Comments
This comment has been minimized.
|
Can you expand on what you mean by "execute multiple updates"? Can you provide the SQL query you'd like to construct? |
This comment has been minimized.
fafhrd91
commented
Jan 30, 2018
|
something like:
|
This comment has been minimized.
|
You just need to call update(posts).set(field.eq("1")).filter(...).execute(&conn)?;
update(posts).set(field.eq("2")).filter(...).execute(&conn)?; |
sgrif
closed this
Jan 30, 2018
This comment has been minimized.
fafhrd91
commented
Jan 30, 2018
•
|
would it execute each update separately? some background, I use diesel for TechEmpower framework benchmarks and it performs very well. https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Rust/actix |
This comment has been minimized.
|
I haven't seen much real world usage that needs to execute multiple unrelated update statements in a single round trip. If you want to optimize for that benchmark, you can pass a SQL string to |
This comment has been minimized.
fafhrd91
commented
Jan 30, 2018
|
Thanks. |
This comment has been minimized.
thomasetter
commented
Sep 26, 2018
|
Another approach which also works with prepared statements is to chain the updates with |
This comment has been minimized.
mjanda
commented
Sep 26, 2018
|
It seems like it's using Nice, didn't even know postgresql can do that. |
fafhrd91 commentedJan 30, 2018
I couldn't find any information on possibility to execute multiple updates.
could anyone point me to a api doc or example?