This only works when your customers are of a reasonable size (e.g. small businesses or individuals) but could provide arbitrary analytics power.
It's also a safe target for AIs to write sql against, if you're into that sort of thing.
This only works when your customers are of a reasonable size (e.g. small businesses or individuals) but could provide arbitrary analytics power.
It's also a safe target for AIs to write sql against, if you're into that sort of thing.
At a high level, we use DuckDB as an in-memory OLAP cache that’s invalidated via Postgres logical replication.
We compute a lot of derived data to offer a read-heavy workload as a product.
Possibly the most dubious choice I tried out recently was letting the front end just execute SQL directly against DuckDB with a thin serialization layer in the backend.
The best apart about it is the hot reload feedback loop. The backend doesn’t have to rebuild to iterate quickly.
(In case you're wondering, https://www.knime.com/)
If you're afraid of users tanking performance, read replicas. As instantaneous as it gets, and no customer can tank others.
Or... depending if your database layout allows, you might be able to achieve that with a per-tenant read replica server and MySQL replication filters [1] or Postgres row filters [2].
A sqlite db is effectively the safest option because there is no way to bypass an export step... but it might also end up seriously corrupting your data (e.g. columns with native timezones) or lack features like postgre's spatial stuff.
[1] https://dev.mysql.com/doc/refman/8.4/en/change-replication-f...
[2] https://www.postgresql.org/docs/current/logical-replication-...