-
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
Cosmos DB: Find/FindAsync performs SQL API query when entity has embedded entities #24202
Labels
area-cosmos
area-perf
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
punted-for-6.0
type-enhancement
Milestone
Comments
We are facing the exact same bug. |
ajcvickers
added a commit
that referenced
this issue
Jun 4, 2024
This change stops using `ReadItemExpression`, since it does not do any shaper processing, and instead uses `SelectExpression` as for other queries. This allows processing of auto-Includes for owned types, even if Find is being translated to `ReadItem`. This is somewhat hacky now, but it likely to change again as the processing for Includes and/or complex types is changed. For now, it's a reasonable way to get an important feature working. Fixes #24202 In addition, the pattern matching has been updated to detect calls to non-generic Find. Fixes #33881
ajcvickers
added
the
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
label
Jun 4, 2024
ajcvickers
added a commit
that referenced
this issue
Jun 5, 2024
This change stops using `ReadItemExpression`, since it does not do any shaper processing, and instead uses `SelectExpression` as for other queries. This allows processing of auto-Includes for owned types, even if Find is being translated to `ReadItem`. This is somewhat hacky now, but it likely to change again as the processing for Includes and/or complex types is changed. For now, it's a reasonable way to get an important feature working. Fixes #24202 In addition, the pattern matching has been updated to detect calls to non-generic Find. Fixes #33881
ajcvickers
added a commit
that referenced
this issue
Jun 5, 2024
This change stops using `ReadItemExpression`, since it does not do any shaper processing, and instead uses `SelectExpression` as for other queries. This allows processing of auto-Includes for owned types, even if Find is being translated to `ReadItem`. This is somewhat hacky now, but it likely to change again as the processing for Includes and/or complex types is changed. For now, it's a reasonable way to get an important feature working. Fixes #24202 In addition, the pattern matching has been updated to detect calls to non-generic Find. Fixes #33881
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-cosmos
area-perf
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
punted-for-6.0
type-enhancement
Include your code
When using Cosmos DB + EntityFrameworkCore 5.0.3, the
FindAsync
andFind
methods do not perform the cheaper (w.r.t. RU) document lookup query when there are owned (embedded) entities.When the
PackageAggregate
entity has no embedded entity, the lookup performs this API call to Cosmos DB. This costs 1 RU.When there is an embedded entity, a SQL API query is made, costing nearly 3 times as much (3.03 RU).
Full repro code
Include provider and version information
EF Core version: 5.0.3
Database provider: Microsoft.EntityFrameworkCore.CosmosDB
Target framework: .NET 5.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.10 Preview 1 internal
The text was updated successfully, but these errors were encountered: