One of our web apps need a small subset of data from Postgres and we use DuckDB WASM to keep it clost to front end. Yes, I agree with not using it for for OLTP workloads. But instead of installing like author mentions in the post, this is a light replacement that works perfectly if you need a Postgres like DB in your app. Just have to add a new file, INSTALL postgres, LOAD postgres,
ATTACH 'dbname=mydb user=dbname host=25.25.25.25 password=aaaa AS db (TYPE postgres, READ_ONLY);
You can CREATE TABLE my_duck_table_stream AS
SELECT * FROM db.table_stream;
Comments
When I want to treat my Postgres like SQLite , I use DuckDB using PostgreSQL Extension https://duckdb.org/docs/stable/core_extensions/postgres.html and this is one of may extensions, there is more and I love DuckDB for that
While I really like DuckDB, I wouldn't use it for OLTP workloads.
I'm curious, when do you want to treat your Postgres like SQLite? :-) That's basically the opposite of what I was thinking of in the article.
One of our web apps need a small subset of data from Postgres and we use DuckDB WASM to keep it clost to front end. Yes, I agree with not using it for for OLTP workloads. But instead of installing like author mentions in the post, this is a light replacement that works perfectly if you need a Postgres like DB in your app. Just have to add a new file, INSTALL postgres, LOAD postgres,
ATTACH 'dbname=mydb user=dbname host=25.25.25.25 password=aaaa AS db (TYPE postgres, READ_ONLY);
You can CREATE TABLE my_duck_table_stream AS SELECT * FROM db.table_stream;
It's just fun
I had no idea that was possible. I'll keep that in mind if I need a similar workflow. DuckDB is awesome. :D
In what kind of scenarios are you using Duckdb from postgres? And does it improve over, say, having a Clickhouse instance nearby?