SQLite vs. SQLCE

Performance optimization

The memory usage of embedded databases is important. We compare that of Microsoft's SQLCE and the open-source SQLite. The version of your program using SQL Server CE may not be fast enough. We look at how these two databases perform.

SQLite FTS3 Virtual Table
Comparison of SQLCE and SQLite

SQLCE program:  8.6 MB
SQLite program: 6.2 MB [smaller]

Notes:Figures are entire Windows Forms memory usage.
The SQLCE version is 3.5.
SQLite used 2.4 MB less memory.


File: text page

You might be able to switch from SQLCE to SQLite for a performance advantage. The numbers here show how my program's memory usage changed, first with SQLCE and then SQLite. I was unable to accurately measure performance due to specifics.

SQLite uses less memory when it is loaded into memory than SQLCE. This decreased footprint would improve spatial locality. It could help other parts of your program stay in memory longer and be faster.

SQlite is compatible with Mac OS X and Linux, unlike SQLCE. Your Mac users could use the same databases on their systems. Mac users will not have the .NET Framework installed. But this is not important in Windows-only offices.

SQLite in C#

C# programming language

The best method I have found to use SQLite in the C# language is an open-source ADO.NET provider. It combines C# and SQLite and is simply called System.Data.SQLite. I highly recommend it if you need a client-side database.

Note:The project also includes FTS3, full-text search, in the assembly. Link removed because it is no longer operational.


Programming tip

Here we saw that SQLite can sometimes use less RAM than SQLCE.
SQLite is a capable database
and is in the public domain,
thanks to its creator Richard Hipp. SQLite generally consumes less memory and is faster than SQLCE.

C#: Data