Back to topics

Embedding Postgres: Could You Treat Postgres Like SQLite?

1 min read
188 words
Database Debates Embedding Postgres:

What if we treated Postgres like SQLite? pglite is an embeddable Postgres you can run in process as a local DB, just like SQLite. It’s the kind of idea that makes you rethink deployment boundaries [1].

Portability — In-process Postgres promises SQLite-like locality, but it would miss the standardized disk format aspect of SQLite [1]. In the discussion, other embeddable options pop up, including DuckDB and sqlite-vector [1].

Testing & Dev Workflows - Some setups preinstall PG, start it for unit tests, then shut it down; testing runs fast [1]. - Running PG in a container with docker-compose or similar is a common approach [1]. - PG detests running as PID 0, which can complicate make check in Docker [1].

Tradeoffs — The in-process approach trades portability and simplicity for potential mismatches in Postgres' disk behavior and testing quirks. It would lack SQLite's standardized disk format, a detail often cited in the discussion [1].

Closing thought — It’s a compelling idea, but the fit depends on your tolerance for setup, testing patterns, and performance questions. Keep an eye on pglite, DuckDB, and sqlite-vector as this space evolves [1].

References

[1]
HackerNews

What if we treated Postgres like SQLite?

Discusses embedding Postgres like SQLite, mentions pglite, DuckDB, and sqlite-vector, exploring in-process usage, testing, and portability tradeoffs.

View source

Want to track your own topics?

Create custom trackers and get AI-powered insights from social discussions

Get Started