views:

246

answers:

2

Hi everyone

I work with DB (SqlCe) in WinCE (C#)

After search and insert of 300 records, the terminal start to work very slow

What can I do to make it faster? Can I have a little sample?

Thanks for any help

+3  A: 

SQLCE certainly can perform fast for both lookups and inserts - I've done 10's of thousands of inserts per second on a table easily. I've also done queries against tables with 100's of thousands of rows in millisecond times.

You've not outlined how you use the database, so it's really hard to say why you see "slowness".

Are you using ResultSets? They tend to be faster than, say a DataSet.

Are you using non-scrollable cursors? Scollable cursors require more overhead.

Have you considered using TableDirect? It's way faster for single-table (i.e. not JOINed) queries.

How about indexes on the table? Indexes make a significant improvement on query and inserts, and the benefits increase as table size (row count) increases.

Your specific usage may also benefit from doing in-memory caching of values.

ctacke
Wow. Saved for when I do some WinCE work. Nice answer.
Will
+1  A: 

Depending on the system you're running on, it may be that it's simply the devices's storage which is that slow.

I found a simple SELECT query (select a row from a db with 1 table, 1 column and 1 row) to take 22 ms on a WinCE device I'm working on at work. So in our case, the solution was to cache everything in memory. If you absolutely need database querying functionality, find one which can create in-memory databases (I don't think SQLCE can do that, but SQLite does support it)

jalf