I have a stored procedure in SQL Server 2005 (SP2) which contains a single query like the following (simplified for clarity)
SELECT * FROM OPENQUERY(MYODBC, 'SELECT * FROM MyTable WHERE Option = ''Y'' ') OPTION (MAXDOP 1)
When this proc is run I can see the plan appear in sys.dm_exec_query_stats with a high 'total_worker_time' value. However, when I run it in SQL Management Studio the statistics show a very low CPU time, as I'd expect. Although the query takes some time to return, because of the slowness of the server it is talking to, it doesn't return many rows.
I'm aware of the issue that parallel queries in SQL Server 2005 can present odd CPU times, which is why I've tried to turn off any parallism with the query hint (though I don't think that there was any in any case).
I don't know how to account for the discrepancy - can anyone give me a steer?
UPDATE: I was assuming that the problem was with the OPENQUERY so I tried looking at times for a long-running query which doesn't use OPENQUERY. In this case the statistics (gained by setting STATISTICS TIME ON) reported the CPU time at 3315ms, whereas the DMV gave it at 0.511ms. The total elapsed times reported by each method agreed.