Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

H2 Database vs SQLite on Android

Because of the lack of Unicode support on the embedded SQLite database in Android

I am mostly interested in performance and stability of H2 Database vs Android SQLite

Are you guys using it? Should I be aware of any H2 database shortcomings?

like image 539
Eduardo Avatar asked Jul 27 '10 17:07

Eduardo


People also ask

Is H2 better than SQLite?

SQLite is much more robust to corruption. Speed wise H2 was much faster in my case. With SQLite transactions are particularly costly, so you should prefer doing bulk operations within transactions or via batches.

Is SQLite good for Android?

Android SQLite is a very lightweight database which comes with Android OS. Android SQLite combines a clean SQL interface with a very small memory footprint and decent speed. For Android, SQLite is “baked into” the Android runtime, so every Android application can create its own SQLite databases.

What is faster than SQLite?

With Actian Zen, developers and product managers get all the advantages of SQLite but in a powerful, secure, and scalable engine that can run serverless or as a client-server. Actian Zen is orders of magnitude faster than SQLite.

Is H2 a good database?

As of 2019, H2 is a superb database. We use it in all of our standalone applications since 4 years and we see it minimizes a gap between SQLite and MySQL. It performs as fast as or faster than MySQL.


1 Answers

Things are much better than I have expected. I now have an Android phone (HTC Desire, Android 2.2) and I made a first test.

Opening and closing a database is relatively slow so far (opening an existing database for the second time takes 0.2 seconds, closing about 0.2 seconds), but otherwise it looks like H2 performs quite well on Android, even if the Dalvik VM is not yet as optimized as a desktop JVM. It's too early to give concrete numbers, but Android is now a supported platform.

like image 186
Thomas Mueller Avatar answered Oct 15 '22 14:10

Thomas Mueller