Cargo Features

[dependencies]
cozo = { version = "0.7.6", default-features = false, features = ["compact", "compact-single-threaded", "minimal", "storage-sqlite", "storage-sqlite-src", "storage-rocksdb", "graph-algo", "requests", "jemalloc", "io-uring", "wasm", "storage-sled", "storage-tikv"] }
default = compact

# Features

compact default = graph-algo, minimal, requests

Enables the minimal, requests and graph-algo features.

compact-single-threaded = graph-algo, minimal, requests

Enables the minimal, requests and graph-algo features in single threaded mode.

minimal compact compact-single-threaded? = storage-sqlite, storage-sqlite-src

Enables the storage-sqlite feature.

storage-sqlite minimal?

Enables the Sqlite backend, also allows backup and restore with Sqlite data files. Sqlite is easy to compile, has very low resource requirements and reasonable performance, but does not support much concurrency.

Enables sqlite ^0.32.0

storage-sqlite-src minimal?

Enables bundled of sqlite3-src ^0.5.1

storage-rocksdb

Enables the RocksDB backend. RocksDB is hard to compile on some platforms, uses more resources than SQLite, but is very performant and supports an extremely high level of concurrency. You can also fine-tune RocksDB options.

Enables cozorocks

graph-algo compact compact-single-threaded? = graph, rayon

Enables the graph algorithms.

requests compact compact-single-threaded?

Allows the utilities to make web requests to fetch data.

Enables minreq

jemalloc

Uses jemalloc as the global allocator, can make a difference in performance.

Enables tikv-jemallocator-global ^0.5.0, jemalloc of optional cozorocks

io-uring

Enables io-uring option for the RocksDB storage

Enables io-uring of optional cozorocks

wasm

Polyfills for the WASM target

Enables js-sys, js of uuid

storage-sled

The following features are highly experimental:

Enables the Sled backend. Sled is slower than Sqlite for the usual workload of Cozo, can use quite a lot of disk space, and may not be stable enough. In general you should use RocksDB instead. The Sled engine does not support time travel.

Enables sled

storage-tikv

Enables the TiKV client backend. The only reason that you may want to use this is that your data does not fit in a single machine. This engine is orders of magnitude slower than every other engine for graph traversals, due to the significant network overhead. Simple point-lookup queries are fine, though. The TiKV engine does not support time travel.

Enables tikv-client and tokio

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

Recommendation for features to enable

Generally you will want the storage-sqlite and graph-algo features enabled, unless your environment makes compiling them difficult. The backup/restore functionalities are only available if storage-sqlite is on. Without graph-algo you cannot use any graph algorithms (utilities are still available), which could be OK if you only want to deal with pure Datalog.

The requests feature allows the database to make outgoing HTTP requests to fetch data into queries -- only enable it if you need it.

The wasm feature simply patches some functions so that they can compile on WASM platform, which lacks some std implementations at the moment. (On WASM you must also enable nothread). This feature will not work on any other platform.

The jemalloc feature only makes sense for desktop and servers. It could improve performance, sometimes substantially, but you need to benchmark for your use case. It also tends to break builds on untested platforms. None of our prebuilt binaries have it enabled.

Enable storage-rocksdb if you expect high concurrency or want better performance than SQLite, but note that RocksDB is much more resource-hungry and takes long to compile.

The other storage options are just for experimentation. We do not recommend using them.

rayon graph-algo?
graph graph-algo?