Force use of the LIKE operator

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
nbonne
Posts: 16
Joined: Fri 28 Nov 2008 10:11

Force use of the LIKE operator

Post by nbonne » Fri 20 Feb 2009 13:34

Is there a .NET string method that can force the use of the LIKE operator in the resulting Oracle SQL query ?

I am having an entity Linq query that goes like this :

var productsQuery = from product in entities.products
where product.name.StartsWith("Food")
select product;

When you run this code and trace the generated SQL with the Oracle monitor class it ends up in the where clause of the Oracle SQL as "where INSTR(PRODUCT, 'Food') = 1". This makes the SQL execution much slower compared to an SQL where clause "Where product LIKE 'Food%'"

I tried the .NET Substring method instead of StartWith which results in the Oracle SUBSTR function but with similar poor performance of the SQL execution.

Is it worth to try with Entity SQL using Object Services instead of LINQ queries using Object Services ?

I am using Devart DotConnect 5.0.20.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 24 Feb 2009 08:53

Thank you for your inquiry. I will let you know about the results of our investigation.
As for Entity SQL, the realization is the same, so there will be no difference.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 23 Sep 2009 08:01

We have increased the performance of the StartsWith, EndsWith and Contains methods.

Post Reply