1

I am having a strange performance problem with ATL/OLEDB (C++).

When I iterate over a recordset, I use the MoveNext method to move to the next record. So when I measured the time it takes to execute the MoveNext method, the very last invocation (which sets the handle to DB_S_ENDOFROWSET) takes a very long time. Quantitatively here is some data:

  • Normal Movenext() takes about 20 microseconds on average.
  • Final MoveNext() which sets the handle to DB_S_ENDOFROWSET takes 650000 microseconds.

Has anyone else seen this behavior?

Another really weird observation is that this problem seems to be dependent on the indexes that have been defined for the database. IOW, if I alter my index definitions, this performance issue goes away.

Does anyone have a clue about what is going on?

I am using SQL Server CE 4.0.

rohitsan
  • 1,001
  • 8
  • 31
  • Has the database file been created on one OS and then moved to another? – ErikEJ May 19 '14 at 16:49
  • Actually, I was wrong. You are correct - the database file was created on another machine (but the same OS type) and then moved to my machine. Why should that matter? – rohitsan May 23 '14 at 17:19
  • See this http://blogs.msdn.com/b/sqlservercompact/archive/2009/04/01/after-moving-the-database-from-one-platform-to-other-the-first-sqlceconnection-open-takes-more-time.aspx – ErikEJ May 23 '14 at 19:13
  • Based on my understanding of the content at that link, the performance issues that I am seeing should only occur on the first query. Subsequent queries should not exhibit the issues. However, I am seeing the issues *every* time. After the indexes are rebuilt on my OS, then even if my application exits and restarts, that index rebuild should not be necessary because w.r.t. the previous run, the OS has not changed. – rohitsan May 23 '14 at 19:21

0 Answers0