Where(string == string) translates to DBMS_LOB.COMPARE
Posted: Fri 10 Aug 2018 10:24
Hi,
I'm reviewing the Oracle provider for Entity Framework Core as part of the trial period to assess suitability for our project.
I'm trying to do a simple string comparison to get a filtered result of an entity.
My dbcontext looks something like this (all properties are strings)-
If I do -
It generates
which takes a huge amount of time to query (10+ seconds), as opposed to doing just a simple WHERE "model".SUMMARY = "sometext" which takes less than 100ms.
Strangely enough, if I change the key in the dbcontext to be the Summary field instead, it runs using the faster method.
Does anyone know why I would have this behaviour? The field I'm comparing against is a VARCHAR2 and I was under the impression that it would only do DBMS_LOB.COMPARE on CLOB fields.
Thanks
I'm reviewing the Oracle provider for Entity Framework Core as part of the trial period to assess suitability for our project.
I'm trying to do a simple string comparison to get a filtered result of an entity.
My dbcontext looks something like this (all properties are strings)-
Code: Select all
modelBuilder.Entity<Item>(entity =>
{
entity.ToTable("TABLENAME");
entity.HasKey(model => model.Id);
entity.Property(p => model.Id).HasColumnName("ITEMID");
entity.Property(p => model.Summary).HasColumnName("ITEMSUMMARY");
});
Code: Select all
var item = await _dbContext.Item.Where(model => model.Summary.Equals("sometext").ToListAsync();
Code: Select all
SELECT "model".ITEMID, "model".ITEMSUMMARY FROM "TABLENAME" "model" WHERE DBMS_LOB.COMPARE("model".SUMMARY, :p__message_Id_0) = 0"
Strangely enough, if I change the key in the dbcontext to be the Summary field instead, it runs using the faster method.
Does anyone know why I would have this behaviour? The field I'm comparing against is a VARCHAR2 and I was under the impression that it would only do DBMS_LOB.COMPARE on CLOB fields.
Thanks