-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Switch to RETURNING/OUTPUT as the default way to retrieve generated values for INSERT #27503
Closed
Tracked by
#26797
Labels
area-perf
area-save-changes
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
providers-beware
type-enhancement
Milestone
Comments
roji
added a commit
to roji/efcore
that referenced
this issue
Mar 4, 2022
…tions Also make RETURNING the default INSERT strategy for retrieving db-generated values (for other providers). Fixes dotnet#27372 Fixes dotnet#27503
roji
added a commit
to roji/efcore
that referenced
this issue
Mar 4, 2022
…tions Also make RETURNING the default INSERT strategy for retrieving db-generated values (for other providers). Fixes dotnet#27372 Fixes dotnet#27503
roji
added a commit
to roji/efcore
that referenced
this issue
Mar 4, 2022
…tions Also make RETURNING the default INSERT strategy for retrieving db-generated values (for other providers). Fixes dotnet#27372 Fixes dotnet#27503
roji
added a commit
to roji/efcore
that referenced
this issue
Mar 9, 2022
…tions Also make RETURNING the default INSERT strategy for retrieving db-generated values (for other providers). Fixes dotnet#27372 Fixes dotnet#27503
roji
added
the
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
label
Mar 10, 2022
roji
added a commit
to roji/efcore
that referenced
this issue
Mar 16, 2022
…tions Also make RETURNING the default INSERT strategy for retrieving db-generated values (for other providers). Fixes dotnet#27372 Fixes dotnet#27503
roji
added a commit
to roji/efcore
that referenced
this issue
Mar 16, 2022
…tions Also make RETURNING the default INSERT strategy for retrieving db-generated values (for other providers). Fixes dotnet#27372 Fixes dotnet#27503
roji
added a commit
to roji/efcore
that referenced
this issue
Mar 16, 2022
…tions Also make RETURNING the default INSERT strategy for retrieving db-generated values (for other providers). Fixes dotnet#27372 Fixes dotnet#27503
roji
added a commit
to roji/efcore
that referenced
this issue
Mar 16, 2022
…tions Also make RETURNING the default INSERT strategy for retrieving db-generated values (for other providers). Fixes dotnet#27372 Fixes dotnet#27503
roji
added a commit
to roji/efcore
that referenced
this issue
Mar 17, 2022
…tions Also make RETURNING the default INSERT strategy for retrieving db-generated values (for other providers). Fixes dotnet#27372 Fixes dotnet#27503
roji
changed the title
Switch to RETURNING/OUTPUT as the default way to retrieve generated values
Switch to RETURNING/OUTPUT as the default way to retrieve generated values for INSERT
Mar 17, 2022
8 tasks
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-perf
area-save-changes
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
providers-beware
type-enhancement
#27372 is about optimizing the SQL generated for fetching generated values on SQL Server; as part of that, we will be switching to
INSERT INTO foo (bar) OUTPUT VALUES ...
by default, which works considerably faster than the current method.SQL Server, PostgreSQL, MySQL and SQLite all support such a method of retrieving generated values (the standard clause is RETURNING except for in SQL Server). Aside from two SQL statements being generally more efficient (and safer) than one, two SQL statements also need to be wrapped in a transaction, to prevent a race condition where a separate update could cause different values to be returned (see #27446). With #27439 removing transactions for single updates, switching to RETURNING would unlock that perf benefit as well.
For example, SQLite shows the following improvement when switch from our current method to RETURNING:
Benchmark code
/cc @lauxjpn
The text was updated successfully, but these errors were encountered: