Page 1 of 1

Force use of the LIKE operator

Posted: Fri 20 Feb 2009 13:34
by nbonne
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.

Posted: Tue 24 Feb 2009 08:53
by AndreyR
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.

Posted: Wed 23 Sep 2009 08:01
by AndreyR
We have increased the performance of the StartsWith, EndsWith and Contains methods.