Ok, hear me out: what if we make something that takes a postgres database dir, tars it together and encodes it as a binary blob in SQLite? We could have SQLite within postgres within sqlite within postgres! Is it practical or even slightly useful? Of course not - but it's SQL databases all the way down. Not that this is a good thing in itself.
Take it one step further, the table-oriented database(tm) , embed clickhouse, MongoDB, Redis and PostgreSQL to ensure you have more flexibility than anyone can utilize efficiently. The one database to rule them all.
Show HN: Embed an SQLite database in your PostgreSQL table
101–110 of 116 posts
Re: Show HN: Embed an SQLite database in your PostgreSQL table
#102Ok, hear me out: what if we make something that takes a postgres database dir, tars it together and encodes it as a binary blob in SQLite? We could have SQLite within postgres within sqlite within postgres! Is it practical or even slightly useful? Of course not - but it's SQL databases all the way down. Not that this is a good thing in itself.
This is some kind of RDBMS mutant CRUDucken.
Re: Show HN: Embed an SQLite database in your PostgreSQL table
#103If you’re using Postgres, multi tenancy has been solved with row level security. It’s super easy to add a tenant id column to every table and a policy that only allows connections to see data from one tenant
RLS is very useful and can solve multi tenancy and other problems, but it is complicated and can add a significant per row cost to queries if your policies get complicated. The common path of comparing some constant like the role name to some column in the table is fine, and it's fast enough as the policy checker already has the row in hand when it does the check, but the natural tendency for people to want to abstra…
Re: Show HN: Embed an SQLite database in your PostgreSQL table
#104Earlier quoted context omitted.
Our UI looks like a table: https://www.notion.so/help/intro-to-databases As long as we never add new features, never need to change how we map UI Postgres DDL, and our users never make any mistakes when they change their tables, it could work without being a complexity nightmare
Curious - so how do you manage client-specific schemas then? Do you just have mappings in postgres (column1, column2, column3, etc.) or maybe store a client specific schema in bson per client?
Re: Show HN: Embed an SQLite database in your PostgreSQL table
#105Re: Show HN: Embed an SQLite database in your PostgreSQL table
#106> Most relational database management systems do not support nested records, so tables are in first normal form by default. In particular, SQL does not have any facilities for creating or exploiting nested tables. [0] “Not with that attitude.” – frectonz [0]: https://en.wikipedia.org/wiki/First_normal_form
Re: Show HN: Embed an SQLite database in your PostgreSQL table
#107Re: Show HN: Embed an SQLite database in your PostgreSQL table
#108Re: Show HN: Embed an SQLite database in your PostgreSQL table
#109> Most relational database management systems do not support nested records, so tables are in first normal form by default. In particular, SQL does not have any facilities for creating or exploiting nested tables. [0] “Not with that attitude.” – frectonz [0]: https://en.wikipedia.org/wiki/First_normal_form
Your link already points out that this isn't followed anymore since Json has been added as a default SQL feature
Atomicity of values has been debated for a long time. I’ve come around to the idea that flat arrays can be included in a 1NF table, because they don’t imply any additional structure to the schema. The problem with JSON is that it supports arbitrary K:V pairs as well as nesting, and so can introduce a schema within a schema, which is prone to referential integrity violations (not to mention generally poor performance in RDBMS).
Embedding an entire DB is of course beyond the pale, and my comment was an attempt at wit.
Re: Show HN: Embed an SQLite database in your PostgreSQL table
#110I think SQLite columns for SQLite would be superior to SQLite’s JSON columns whose operators are a whole ‘nother query language you need to learn and seem comparatively limited.
wouldn't that just be a foreign key to another table or, a list of keys or am i missing something?