c# - Linq to SQL and Codepages in generated SQL -


we have poorly-performing query in l2s. actual query looks this:

select * table      ([cola] in (@p0) , colb = @p1)      or colb in (@p2, @p3, @p4, @p5) -- @p0: input int (size = 0; prec = 0; scale = 0) [220] -- @p1: input varchar (size = 14; prec = 0; scale = 0) [countrydefault] -- @p2: input nvarchar (size = 0; prec = 0; scale = 0) [] -- @p3: input nvarchar (size = 0; prec = 0; scale = 0) [] -- @p4: input nvarchar (size = 7; prec = 0; scale = 0) [wf1 1xu] -- @p5: input nvarchar (size = 3; prec = 0; scale = 0) [wf1] -- context: profiledsqlprovider(sql2008) model: attributedmetamodel build: 3.5.30729.1 

one problem merge-sort result of or, we're looking that.

the other problem more interesting. 1 of our dbas pointed out there's quite performance hit in codepage conversion between nvarchar parameters , column they're being compare varchar.

the weird thing how l2s chose of parameters nvarchar, , p1 parameter varchar. in code strings, although p1 string literal while others variables. notice they're being compared same column (colb) it's nothing column datatype.

how l2s decide datatype use when generating query, based on values passed-in? if possible, how control that?

there workaround given in this thread converts parameters correct types.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -