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 Guid as keys on Oracle DBMS, EF.Core 2.2 (or possibly Oracle.EntityFrameworkCore 2.19.60, not sure who is responsible here) the generated SQL causes the DBMS to always skip the index and instead do a full table scan. As you can imagine, this causes massive performance issues.
Steps to reproduce
Define an Entity with an indexed Guid field (e.g. the PK)
publicclassMyEntity{publicGuidId{get;set;}}
The Id-Field will correctly be converted into a RAW(16) column in the database.
SELECT Id FROM MyEntities WHERE Id = N'[someGuid as a string]'
Copy the respective query into your database tool of choice and look at the execution plan. It will (hopefully, or else the error is on my side, which is of course always possible) show a FULL TABLE ACCESS instead of using the primary key index.
Modify the SQL-Query e.g. to have HEXTORAW('[someGuid as a string]') and look at the execution plan again. This time you should see the index being hit (and, for large tables, see a massively improved performance).
Further technical details
EF Core version: 2.2.6
Database provider: Oracle.EntityFrameworkCore 2.19.60
Target framework: (e.g. .NET Core 2.1)
Operating system: Windows
IDE: (Visual Studio 2019 16.5.3)
The text was updated successfully, but these errors were encountered:
@markusbrueckner Thanks for reaching out. Unfortunately, this is an issue with literal generation in the Oracle provider. It will need to be reported to them.
When using
Guid
as keys on Oracle DBMS, EF.Core 2.2 (or possibly Oracle.EntityFrameworkCore 2.19.60, not sure who is responsible here) the generated SQL causes the DBMS to always skip the index and instead do a full table scan. As you can imagine, this causes massive performance issues.Steps to reproduce
The
Id
-Field will correctly be converted into aRAW(16)
column in the database.This leads to SQL of the form
Copy the respective query into your database tool of choice and look at the execution plan. It will (hopefully, or else the error is on my side, which is of course always possible) show a FULL TABLE ACCESS instead of using the primary key index.
Modify the SQL-Query e.g. to have
HEXTORAW('[someGuid as a string]')
and look at the execution plan again. This time you should see the index being hit (and, for large tables, see a massively improved performance).Further technical details
EF Core version: 2.2.6
Database provider: Oracle.EntityFrameworkCore 2.19.60
Target framework: (e.g. .NET Core 2.1)
Operating system: Windows
IDE: (Visual Studio 2019 16.5.3)
The text was updated successfully, but these errors were encountered: