I'm experimenting with building an embedded SQL engine for Node.js and Bun.
The idea is similar to SQLite, but the engine aims to support a large subset of PostgreSQL syntax such as:
- joins
- CTEs
- window functions
- transactions
- JSON operators
The engine runs directly inside the application process and stores data in a local file, without requiring a PostgreSQL server.
One challenge I'm facing is how to design the SQL parser and execution layer to support PostgreSQL-style queries while still keeping the engine lightweight.
For example, SQLite has its own grammar and execution model, while PostgreSQL has a much more complex planner.
My questions are:
- What are the common approaches used by embedded databases to support PostgreSQL-compatible syntax?
- Are there open-source projects or references for implementing a PostgreSQL-like query planner in a lightweight engine?
- Is it realistic to support a meaningful subset of PostgreSQL features without implementing the full PostgreSQL architecture?
For context, I'm experimenting with an open-source prototype here (I'm the author):
Top comments (0)