I have a very strange problem. When I run a query with SET STATISTICS IO ON, it shows that I had a total of 183 reads. But when I look at the query plan dmv it shows I did 555,132 reads. I cleared the query cache before I ran my query, so I know that run was mine. Any ideas?
The reason I am checking this is I'm seeing some sort of bad parameter sniffing going on and when I look at the trace file and the query plan cache I see a query doing around 550k reads, but when I try it manually I only get 183 reads. So I'm guessing there is some setting in my SSMS that is different than the calling server where mine does not use the bad plan, but compiles a new one.
Stats I/O output:
Table 'Artifact'. Scan count 1, logical reads 3, ... Table 'ArtifactType'. Scan count 0, logical reads 180, ... Table 'ObjectType'. Scan count 1, logical reads 3, ...