3 ms·
Even with Unix socket there will be at least one additional copy across kernel - userpace boundary compare to SQLite (and likely at least one copy inside the ke
by citrin_ru 3y ago
Even with Unix socket there will be at least one additional copy across kernel - userpace boundary compare to SQLite (and likely at least one copy inside the kernel too from one socket buffer to another). Yes, a Unix socket has lower overhead than a TCP one, but still not free:
kernel (filesystem) -> app with SQLite library
kernel (filesystem) -> Postgres -> kernel -> app with Postgres client
If Postgres reads data from own cache (not from disk) the chain will be one step shorter: Postgres -> kernel -> client, but the same true for SQLite own cache.
If mmap is used (make sense for small data sets cached in RAM) then reading data by SQLite can be zero-copy [1].
Benchmark result highly depends on a use case - neither is better for all use cases but at least for some use cases SQLite is faster.
[1] https://www.sqlite.org/mmap.html https://www.sqlite.org/mmap.html