You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using FirstOrDefaultAsync there is a considerable performance drop if the entity that is loaded contains very large strings.
In our case the entity which we want to read from database contains a column of type NVARCHAR(max) which stores an xml formatted string. If the size of the xml goes above 10MB the reading time is about 1-2 even 3 minutes.
If the FirstOrDefault method is used the reading times is of a few seconds up to 1 minute.
This issue reproduces only for MSSQL database. We are also using Oracle and PSQL, but for these databases both the synchronous and asynchronous method work as expected.
Assuming the synchronous variant (FirstOrDefault()) is fast, then this is the above issue - it's a well-known SqlClient performance issue with async that EF can't do anything about.
When using FirstOrDefaultAsync there is a considerable performance drop if the entity that is loaded contains very large strings.
In our case the entity which we want to read from database contains a column of type NVARCHAR(max) which stores an xml formatted string. If the size of the xml goes above 10MB the reading time is about 1-2 even 3 minutes.
If the FirstOrDefault method is used the reading times is of a few seconds up to 1 minute.
This issue reproduces only for MSSQL database. We are also using Oracle and PSQL, but for these databases both the synchronous and asynchronous method work as expected.
EF Core version: EFCore 7
Database provider: Microsoft.EntityFrameworkCore.SqlServer 7.0.9
Target framework: .NET 7.0
Operating system: Windows
IDE: Visual Studio 2022 17.6.5
The text was updated successfully, but these errors were encountered: