SQL Server: Returning different number of rows from the same source data? -


i have encountered today far strange behaviour of sql server 2008 me far (or maybe tired figure out going on).

i have complicated statement operating on around 1,100,000 rows. source data in table used subquery , doesn't change. statement looks (i'll include parts cause error in opinion):

select     -- here columns straight subquery , hardcoded columns    'my company' companyname    -- , here important part    sum(subq.importantfloatwithbigprecision)  (   select      -- here simple columns fetched table , after that:     udf.getsomemappedvalue(value) mappedvaluefromfunction     ,importantfloatwithbigprecision   myverybigtable   importantfloatwithbigprecision <> 0     and(...) ) subq group except sum(subq.importantfloatwithbigprecision) having sum(subq.importantfloatwithbigprecision)<>0 order (...) 

i've checked subquery quite few times , returns same results every time, whole query returns 850-855 rows same data! of time (around 80%) 852 rows, 855, 850 , have no idea why.

surprisingly removing <> 0 condition subquery helped @ first glance (so far 6 times got same results), has drastic impact on performance (for amount of rows runs 8-9 mins longer (remember udf? :/)

could explain me? ideas/questions? i'm clueless...

edit (inspired crono): we're running on 2 environments: dev , test , comparing results maybe of settings may differ.

edit 2: values of importantfloatwithbigprecision wide range (around -1,000,000 + 1,000,000) there 'few' (propably in scale around 25k-30k) rows have values close 0 (first non-zero digit on 6-th place after separator, start further) both negative , positive.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -