More
When not to use XOD
XOD is built for applications that own their data. Here is where another database is the better choice, and why.
XOD is for applications that own their data: a desktop app, a service with its own folder, a device with no room for a server. Bulk loads, lookups, indexed queries and paging are where it is fastest, and the whole database is a folder you can copy or commit.
It is the wrong tool in these cases.
Several processes writing the same data
One XodContext owns a database folder at a time: any second open, in the same process or another, is
refused with DatabaseLockedException (see Processes). Inside that single
context XOD is concurrent — many readers at once, with writes serialized one at a time — but it is an
embedded library, not a shared server. If several services must write the same data, use a server database
such as PostgreSQL or SQL Server.
A tight loop of single-row writes
SQLite updates and deletes single rows much faster than XOD; the benchmarks show the gap. If your workload is mostly many small writes, SQLite is the better tool. XOD spends its effort on bulk loads, reads and paging instead.
Replication, clustering or network access
XOD has no network protocol, replication or failover. Use a server database.
Ad-hoc SQL and reporting
db.Sql and xod query support SQL SELECT queries (see
Querying with SQL). Still missing:
- writes in SQL (
INSERT,UPDATE,DELETE); - window functions,
WITH,UNION, and right or full joins; - an ADO.NET, ODBC or JDBC driver for external reporting tools.
Grouping, totals and conditions on unindexed columns scan every row of the table.
Bulk loads of relational graphs
Inserting and loading large customer/order/line graphs is where XOD trails SQLite today. If that is your main workload, measure both with your own data before choosing.
Known limits
- Process crashes mid-write outside a transaction. A failed write leaves nothing behind in any mode
(
Immediate,Buffered, or inside a transaction), but an unjournalled write outside a transaction can leave partial changes if the process is killed mid-write. Use a transaction whenever multiple changes must land atomically across a crash (see Writes outside a transaction). - Power cuts and OS crashes. XOD hands writes to the operating system without calling
fsync; a power cut or OS crash can lose writes the OS hadn’t yet persisted to storage hardware. - Two
nullround-trip edge cases. Anullstored as an XML attribute (ValuePosition.Attribute) reads back as a new instance holds it, and anulllist or map whose property initializer creates an instance reads back initialized (see Values read back as written). - Other programs holding files open. A backup, sync or antivirus tool holding a database file open can cause a write to fail (the failed write is rolled back cleanly, leaving the database intact). Exclude the database folder from real-time scanners while open.
- Network file systems. Because XOD relies on exclusive file locks, opening is refused on file systems
that don’t provide them (such as some NFS clients). On Linux or macOS,
DOTNET_SYSTEM_IO_DISABLEFILELOCKING=1bypasses the lock check when you guarantee nothing else opens the database.