When to Use SQLite
- Transactional workloads: Frequent updates and deletes
- Point queries: Row-based lookups by primary key
- ACID guarantees: Strong consistency required
- Lightweight: Minimal resource overhead
- File-based: Need persistence without external database
Configuration
Memory Mode
Data stored in RAM (volatile):File Mode
Data persisted to disk:Default File Location
Ifsqlite_file not specified, uses {spice_data_dir}/accelerated_sqlite.db:
File Create Mode
Deletes existing file on startup:Refresh Modes
Full Refresh
Replaces all data:Append Mode
Appends only new data:Snapshots
Bootstrap from S3 snapshots for fast cold starts:Busy Timeout
Configure timeout for locked database:Primary Keys and Constraints
Primary Key
Composite Primary Key
On Conflict Behavior
Federation
SQLite accelerators can federate queries across multiple file-mode SQLite databases. Spice automatically attaches other SQLite databases.File Extensions
SQLite supports multiple file extensions:.db.sqlite
Decimal Support
SQLite accelerator includes the decimal extension for precise decimal arithmetic:Performance Characteristics
Query Performance
| Operation | Performance | Notes |
|---|---|---|
| Point queries | Excellent | Row-based storage, indexes |
| Inserts | Excellent | Fast single-row inserts |
| Updates | Excellent | In-place updates |
| Deletes | Excellent | Fast row removal |
| Full table scan | Fair | Row-based (not columnar) |
| Aggregations | Fair | Not optimized for analytics |
| Joins | Good | Small to medium joins |
Storage
| Feature | Details |
|---|---|
| Format | Row-based (B-tree) |
| Compression | None (compact format) |
| Max file size | ~140TB (theoretical), <10GB ideal |
| ACID | Full ACID compliance |
Transactions
SQLite provides full ACID transactions:Write-Ahead Logging (WAL)
SQLite uses WAL mode for better concurrency:- Multiple readers don’t block writers
- Better performance for concurrent access
- Automatic checkpointing
Example Configurations
User Session Store
Transactional Cache
Persistent Lookup Table
Monitoring
Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
| sqlite_file | string | Path to SQLite database file | auto |
| busy_timeout | integer | Timeout in milliseconds for locked DB | 5000 |
Limitations
- Row-based storage (not ideal for analytics)
- Single-file database
- No built-in partitioning
- Limited to ~10GB for best performance
- Write concurrency limited (single writer at a time)
When to Use DuckDB Instead
Consider DuckDB if:- Analytical queries with aggregations
- Dataset > 10GB
- Need columnar compression
- Read-heavy workload
When to Use PostgreSQL Instead
Consider PostgreSQL if:- Need advanced database features (triggers, stored procedures)
- Multi-user concurrent writes
- Dataset > 100GB
- Need replication
Next Steps
- DuckDB Accelerator - For analytical workloads
- PostgreSQL Accelerator - For full-featured database
- Acceleration Overview - Compare all accelerators