News for hackers. Stuff that matters.
Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by jbverschoor on Monday May 25, 2020 @07:11PM (#23305853)
You can use the same connection across multiple databases without any problem.
Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by WatchDog on Monday May 25, 2020 @07:36PM (#23306002)
Not on postgres.
Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by koolba on Monday May 25, 2020 @07:37PM (#23306009)
You can use schemas.

Also it’s still a terrible idea.

Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by andrewflnr on Monday May 25, 2020 @09:30PM (#23306598)
Why is it a terrible idea?
Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by gomox on Monday May 25, 2020 @09:50PM (#23306709)
It's a terrible idea in the same way that using PHP instead of Rust to build a production large scale application is a terrible idea (i.e. it's actually a great idea but it's not "cool").
Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by koolba on Tuesday May 26, 2020 @08:32AM (#23310280)
It’s not a cool factor issue. It’s an issue of bloating the system catalogs, inability to use the buffer pool, and having to run database migrations for each and every separate schema or maintaining concurrent versions of application code to deal with different schema versions.

It’s be just as dumb to do it in Rust as it would be in PHP.

Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by gomox on Tuesday May 26, 2020 @10:20AM (#23311447)
As you can see now that the thread has matured, there are a lot of proponents of this architecture that have production experience with it, so it's likely not as dumb as you assume.
Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by koolba on Tuesday May 26, 2020 @11:20AM (#23312232)
> As you can see now that the thread has matured, there are a lot of proponents of this architecture that have production experience with it, ...

Skimming through the updated comments I do not see many claiming it was a good idea or successful at scale. It may work fine for 10s or even 100s of customers, but it quickly grows out of control. Trying to maintain 100,000 customer schemas and running database migrations across all of them is a serious headache.

> ...so it's likely not as dumb as you assume.

I'm not just assuming, I've tried out some of the ideas proposed in this thread and know first hand they do not work at scale. Index page caching in particular is a killer as you lose most benefits of a centralized BTREE structure when each customer has their own top level pages. Also, writing dynamic SQL to perform 100K "... UNION ALL SELECT * FROM customer_12345.widget" is both incredibly annoying and painfully slow.

Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by gomox on Tuesday May 26, 2020 @03:15PM (#23315289)
I don't think we share the definition of "scale".

Extremely few companies that sell B2B SaaS software for enterprises have 10K customers, let alone 100K (that's the kind of customer base that pays for a Sauron-looking tower in downtown SF). Service Now, Workday, etc, are publicly traded and have less than 5000 customers each.

All of them also (a) don't run a single multitenant cluster for all their customers and (b) are a massive pain in the ass to run in every possible way (an assumption, but a safe one at that!).

Re:Ask HN: Has anybody shipped a web app at scale with 1 DB ... by neeleshs on Monday May 25, 2020 @11:46PM (#23307222)
Yep. Too easy and not cool. But works really well and no headaches