GitHub: https://github.com/HuakunShen/tauri-demo/tree/master/examples/surrealdb
SurrealDB is very powerful, here are its features
- Vector search
- Relation+Document+Graph DB
- FTS
- Time Series
- Geospatial
- KV (like Redis)
Since it's written in Rust, we can embed it in a Tauri app.
## App Size
However, it introduces much higher bundle size compared to sqlite integration.
| Condition | App Size (.dmg) | App Size (.app) |
| ---------------- | --------------- | --------------- |
| Before SurrealDB | 2.9MB | 8.3MB |
| After SurrealDB | 19MB | 54MB |
FYI, in the other example [[drizzle + sqlite in Tauri App]], the app size is 13MB (.app) and 4.8MB (.dmg).
So roughly,
- sqlite integration introduced extra 13-8=5MB and surrealdb introduced extra 54-8=46MB.
- `.dmg` files are compressed. Sqlite integration introduced extra 4.8-2.9=1.9MB and surrealdb introduced extra 19-2.9=16.1MB.
Surrealdb has much more features than sqlite, so there is a trade-off here.
Do you need all features of Surrealdb?
If you want a minimal app, you should use sqlite.
But the size increase is honestly not considered as a big deal today, all the apps are bloated.
Electron apps are typically 200-400MB.
But developers using Tauri may want a minimal app size. You can decide for yourself.
## RAM
- This main process of this SurrealDB example app uses consumes ~100MB of RAM.
- [[drizzle + sqlite in Tauri App]] implements a similar example using the [tauri-plugin-sql](https://crates.io/crates/tauri-plugin-sql) plugin, and consumes ~30MB of RAM (main process).
So 70MB difference. It's not a big deal for modern computers, but still a big difference.