Comparison with SQLite
What Base does today compared with SQLite, and how fast it is. Preliminary, and we show the cases where Base is slower.
Preliminary. Base is pre-release. These numbers change with every build. They are a snapshot, not a promise.
Speed
Time per operation as a percentage of SQLite (SQLite = 100%). Below 100% Base is faster, above 100% Base is slower. Each operation is measured twice: by counted processor instructions (steady) and by actual duration.
| Case | Computing effort (counted processor instructions) | Actual duration |
|---|---|---|
| Point read by key | 72% (28% faster) (Base faster) | 87% (13% faster) (Base faster) |
| Bulk insert | 89% (11% faster) (Base faster) | 98% (2% faster) (About equal) |
| Range scan | 57% (43% faster) (Base faster) | 41% (59% faster) (Base faster) |
| Update | 99% (1% faster) (About equal) | 63% (37% faster) (Base faster) |
| Delete | 104% (4% slower) (About equal) | 72% (28% faster) (Base faster) |
| Join | 95% (5% faster) (About equal) | 55% (45% faster) (Base faster) |
| Aggregation | 67% (33% faster) (Base faster) | 30% (70% faster) (Base faster) |
| Mixed workload of a real application | 98% (2% faster) (About equal) | – |
| Similarity search | 109% (9% slower) (Base slower) | – |
SQLite = 100%
- Faster than SQLite in this measurement (actual duration): Point read by key, Range scan, Update, Delete, Join, Aggregation.
Similarity search
The query for the items most similar to a given one (10 000 items, three terms each), run with the command-line tool. Time per query in milliseconds. Counted instructions per query: Base 87.6 million, SQLite 80.4 million.
Here only the computing effort is meaningful.
File size
Size of the database file for the same data as a percentage of SQLite (SQLite = 100%). Fresh: written in one transaction. After VACUUM: both files compacted. Above 100% Base is larger.
Base files are larger than SQLite files for all four data sets. The full-text index trees of the catalog are still in the older, larger form.
Feature comparison
Base column: state of the source repository. SQLite column: the SQLite reference version 3.54.1 used for the tests.
| Feature | PSOrvia Base | SQLite |
|---|---|---|
| One file, no server | Yes | Yes |
| Transactions and crash recovery | Yes | Yes |
| Several processes on one file | Yes | Yes |
| Checksum on every page read Optional extension in SQLite |
Yes | Partly |
| Strict SQL mode in addition to the SQLite-compatible one STRICT tables in SQLite |
Yes | Partly |
| Views, triggers, common table expressions, window functions | Yes | Yes |
| JSON functions Both with JSONB and the JSON subtype |
Yes | Yes |
| Full-text search Base builds the catalogue index in 27 % and answers its queries in 62 % of the SQLite instruction cost; all four tokenizers, rank/bm25, highlight, snippet |
Yes | Yes |
| Vector similarity search Base has it as a Rust interface |
Partly | No |
| Several database files in one connection (ATTACH) | Yes | Yes |
| Virtual tables and R*Tree index Base: rtree and generate_series built in, further modules in Rust; no modules in C |
Partly | Yes |
| Built-in encryption SQLite only through separate extensions |
Planned | No |
| Runs in existing SQLite programs without changes Base offers about 86 % of the calls of the SQLite programming interface in a separate library, including piecewise access to large values and the database as one byte image; no loadable extensions |
Yes | Yes |
| User-defined functions, collations and hooks | Yes | Yes |
| Interactive command line with dot commands and output modes | Yes | Yes |
| Online backup in steps, VACUUM and VACUUM INTO | Yes | Yes |
| Language bindings Rust, C, C++, Python, PHP, Go, JavaScript, Java, C#, Dart and Ruby today; more planned for 1.0 |
Partly | Yes |
| Documented file format | Base 1.0 is frozen, not released | |
| License | Apache-2.0 for Base; public domain for SQLite | |
| Maturity | Base is pre-release; SQLite is decades old and very widely tested | |
Method
- Computing effort: Callgrind counts the processor instructions of one operation (4 000 rows, measuring phase only).
- Actual duration: the benchmark program runs a Base driver and a SQLite driver in turn on one pinned processor core, 7 runs of 20000 rows with 100-byte values, sync off, warm cache, fixed seed. Only the ratio to SQLite measured in the same minute counts.
- SQLite is the pinned reference build with a 64 MB cache, 512 MB memory map and exclusive locking, the same single-process semantics that Base uses. With SQLite's default settings the point read looks very different, see the notes.
- The program, settings and raw results are in the source repository.
- Both drivers read every column value of every result row, as a client program would. Reading every column is our choice of method; a program that needs only some columns would see other ratios.
Notes
- With SQLite's default settings (a read lock per statement) the point read of Base takes about a quarter of the time, because the settings differ, not because the engine is faster. We use the exclusive-locking comparison above as the fair one.
- Size of the stripped benchmark programs, including a small driver: 512 184 bytes for Base and 1 377 568 bytes for SQLite.
- Compatibility is checked against the SQLite reference with the public sqllogictest corpus: the whole corpus of 622 files passes, 5 939 714 of 5 939 714 records (100.00 percent; one file has no applicable statements), in 379 seconds. A set of 1 500 random differential queries shows no difference.
Measured values from the benchmark notes of PSOrvia Base (version 78f3cc9). Reproducible with the programs in bench/ of the source repository.