Live data from Hacker News

Show HN: Embed an SQLite database in your PostgreSQL table

github.com

61–70 of 116 posts

Re: Show HN: Embed an SQLite database in your PostgreSQL table

#62
post #52

I 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.

I spent some time learning those queries for a project and when I grokked it they where very handy.

Re: Show HN: Embed an SQLite database in your PostgreSQL table

#63
post #61

You may want to use the $$ way to declare strings for your examples. Something like: -- Create a todo for "frectonz" UPDATE people SET database = execute_sqlite( database, $sqlite$INSERT INTO todos VALUES ('solve multitenancy')$sqlite$ ) WHERE name = 'frectonz';

oh nice, i didn't know this existed, thanks

Re: Show HN: Embed an SQLite database in your PostgreSQL table

#64
post #52

I 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?

Re: Show HN: Embed an SQLite database in your PostgreSQL table

#65
post #38
post #31

Earlier quoted context omitted.

When your application scales beyond one machine that needs access to the same database, PostgreSQL becomes an obviously better choice than SQLite. Until that point, SQLite is a fine, and honestly underrated choice. DuckDB is another option worth considering.

Should the concept of "machines" really be a concern of the DB layer? SQLite already allows multiple connections, so putting it on a server and adding a program that talks a network protocol and proxies the queries to the DB sounds more logical to me?

High performance software is written acknowledging the reality that it will run on hardware. Databases tend to be a class of software that is hyper-focused on performance.

Writing a networked application that uses SQLite as a database is perfectly reasonable. You're just making the decision to lift the layer of abstraction that is concerned with machines from the DB to your application, which may or may not be a reasonable thing to do.

Re: Show HN: Embed an SQLite database in your PostgreSQL table

#66
post #58
post #44

Earlier quoted context omitted.

Notion has 100 million users, managing schema-per-tenant at our scale sounds like a complexity nightmare. We have 480+ identical schemas across 100+ Postgres hosts, and that already takes a lot of brainpower & engineering time to manage T_T

> managing schema-per-tenant at our scale sounds like a complexity nightmare. The per-tenant schema could be the tenant's responsibility. Most non-technical users can handle the idea of tables & columns, assuming you leverage UI/UX patterns they are already familiar with.

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

Re: Show HN: Embed an SQLite database in your PostgreSQL table

#67
post #24

That’s fun, but I think I'll just use an SQLite foreign data wrapper instead.

Then you need one wrapper per database, with this approach you can have one database per row.

But can I have one row that holds all the databases?

Re: Show HN: Embed an SQLite database in your PostgreSQL table

#69
post #67

Earlier quoted context omitted.

Then you need one wrapper per database, with this approach you can have one database per row.

But can I have one row that holds all the databases?

yes you can

CREATE TABLE crime_against_humanity ( databases SQLITE[] );

Post reply on HN