Which of the following versions for the same query will perform better:
Version 1 (string.Contains):
var query = db.Products
.Where( p => p.Description.Contains( description ) );
Version 2 ( SqlFunctions.PatIndex ):
var query = db.Products
.Where( p => SqlFunctions.PatIndex("%" + description + "%",p.Description) > 0 );
I believe version 1 runs faster theoretically.
Reasons:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With