title: 'Turso Data Accelerator' sidebar_label: 'Turso Data Accelerator' description: 'Turso (libSQL) Data Accelerator Documentation' sidebar_position: 6 tags:
:::info Beta The Turso Data Accelerator is in Beta. Features and configuration may change. :::
The Turso Data Accelerator uses Turso (built on libSQL, a fork of SQLite) as the acceleration engine for caching and accelerating query performance. Turso provides native async support and modern improvements over traditional SQLite while maintaining SQLite compatibility.
To enable Turso acceleration, set the dataset's acceleration.engine to turso:
By default, Turso acceleration uses mode: memory, creating an in-memory database for fast temporary caching:
When using mode: file, datasets are stored by default in a Turso database file on disk in the .spice/data directory relative to the spicepod.yaml. Specify the turso_file parameter to store the database file in a different location:
Turso acceleration supports the following optional parameters under acceleration.params:
turso_file (string, default: .spice/data/{dataset_name}.turso): Path to the Turso database file. Only applies if mode is file. If the file does not exist, Spice creates it automatically.turso_mvcc (string, default: disabled): Enable Multi-Version Concurrency Control (MVCC) for improved concurrent read/write performance. Values: enabled, disabled.internal_timestamp_format (string, default: rfc3339): Internal timestamp storage format. See Timestamp Storage section. Values: rfc3339, integer_millis.Refer to the datasets configuration reference for additional supported fields.
Turso supports two timestamp storage formats to accommodate different use cases:
By default, timestamps are stored as RFC3339 TEXT strings (e.g., "2024-01-01T00:00:00.123456789Z"). This format preserves all timestamp information:
For performance-critical use cases, set internal_timestamp_format: "integer_millis" to store timestamps as integers (milliseconds since Unix epoch):
Multi-Version Concurrency Control (MVCC) can be enabled for improved concurrent read/write performance:
When MVCC is enabled:
Turso supports index creation for improved query performance (when MVCC is disabled):
See Indexes for more details.
Turso uses connection pooling for efficient database access. Connection pools are shared across datasets using the same database file.
Turso supports query federation, where queries can span multiple data sources. The accelerator pushes down filters, projections, and limits when possible for improved performance.
turso_url and turso_auth_token are not supported in this accelerator context. Remote Turso support will be available when Turso is implemented as a data connector.List types of primitive data types are supported; lists with structs are not supported.Turso is built on libSQL (a fork of SQLite) and offers several advantages:
| Feature | Turso | SQLite |
|---|---|---|
| Async Support | Native async via libSQL | Synchronous with spawn_blocking |
| Connection Model | Modern async pooling | Traditional sync connections |
| Performance | Optimized for modern workloads | Traditional SQLite performance |
| File Extensions | .turso, .db, .sqlite, .sqlite3 | .db, .sqlite, .sqlite3 |
Choose Turso when you need:
Choose SQLite when you need:
:::warning[Memory Considerations]
When accelerating a dataset using mode: memory (the default), the dataset is loaded into memory. Ensure sufficient memory is available, including overhead for queries and the runtime, especially with concurrent queries.
In-memory limitations can be mitigated by storing acceleration data on disk using mode: file.
:::
Turso is an optional feature in Spice. To build with Turso support: