News for hackers. Stuff that matters.
Re:SQL: 2023 Has Been Released by derefr on Thursday June 01, 2023 @02:41PM (#36155478)
Graph databases are about as different from RDBMSes storage-wise, as column-stores are from row-stores. It comes down to how you plan to shard data and distribute queries when data doesn't fit on a single node.

Using graph DBs (or their underlying KV stores, as in FoundationDB), you can have a single graph spread over many machines representing e.g. Facebook's social graph, and run a query which "chases around" edges between vertices that live on different nodes, to solve that query, while ensuring that as little of that has to happen as possible — both by rebalancing vertices so that data is sharded at low-connection-degree points in the graph; and by consolidating the steps of queries that occur on the same node into single batch queries, such that the whole thing becomes (close to) a single map/reduce step.

There's nothing in Postgres that knows how to do that; if you had e.g. a graph stored in a Citus hypertable, and did a recursive CTE over it to do graph search, then you'd get pretty dang bad perf.

Re:SQL: 2023 Has Been Released by MarkusWinand on Thursday June 01, 2023 @02:45PM (#36155533)
> It comes down to how you plan to shard data and distribute queries when data doesn't fit on a single node.

A problem everbody would love to have but pretty much nobody actually has.

Re:SQL: 2023 Has Been Released by jupp0r on Thursday June 01, 2023 @03:22PM (#36156082)
> A problem everbody would love to have

Except the people who do have it and need to keep their business running off of one postgres instance.

Re:SQL: 2023 Has Been Released by throwaway894345 on Thursday June 01, 2023 @04:01PM (#36156570)
You can have data that fits on one machine and still run multiple instances of postgres in a failover configuration, which will probably cover just about everyone (depending on your filesystem, disk for a single instance is essentially infinite, so I'm not actually sure what bottleneck would motivate you need to scale beyond this configuration).
Re:SQL: 2023 Has Been Released by threeseed on Thursday June 01, 2023 @04:34PM (#36156975)
There is a reason the world moved on from failover architectures.

a) At some point you will have more data or more users than one instance can handle. And instead of simply adding another node you need to throttle usage in order to do a rolling upgrade. Which is far easier said than done and involves impact to the business.

b) With distributed databases you are constantly testing that everything works in Dev, Test etc environments. With failover you really only test it every now and again usually before you deploy to Production. And in most companies which are hopeless the testing will be guaranteed to be inadequate.

c) Vendors lie. They promise that failover will just work but in my experience it very often doesn't. Which is another reason why b) is such important to validate their claims.

Re:SQL: 2023 Has Been Released by throwaway894345 on Thursday June 01, 2023 @05:56PM (#36157930)
I mean, I don't like that Postgres is not infinitely scalable, but the whole point is that (a) is not generally true--most companies could probably get by with a single machine's worth of data, or rather if they have more than one machine's worth of data, those systems probably aren't talking to each other such that they need to be on the same box. Regarding (b) and (c), do you not need to test failure conditions for distributed databases (this isn't rhetorical, I've only ever used cloud providers offerings)?
Re:SQL: 2023 Has Been Released by pooper on Thursday June 01, 2023 @11:13PM (#36160442)
> most companies could probably get by with a single machine's worth of data, or rather if they have more than one machine's worth of data those systems probably aren't talking to each other such that they need to be on the same box

one of the things I would like to see in my lifetime is somehow it should be easier to "run the whole enterprise" from one box. Sure, it will probably be seriously underpowered and I can't do all things at once but for most small to mid-size companies, it should be possible to run all our "code" from one machine.

I think of this as some kind of development or pre-qa environment. It really shouldn't be that big of an ask...

I am thinking most, if not all, companies will be able to fit their entire enterprise on a Supermicro A1+ server with two 96-core processors. Sure, there is no machine in the world that can fit all of YouTube videos but there is no reason why we can't have YouTube, with a limited set of non-production data, running from just one box. Thoughts?

Re:SQL: 2023 Has Been Released by throwaway894345 on Friday June 02, 2023 @03:55PM (#36169975)
> one of the things I would like to see in my lifetime is somehow it should be easier to "run the whole enterprise" from one box. Sure, it will probably be seriously underpowered and I can't do all things at once but for most small to mid-size companies, it should be possible to run all our "code" from one machine.

I think that's the mainframe idea. There's probably some interesting philosophical question in there about whether or not a data center is just a big mainframe. It sort of feels like it verges on semantics.

> Sure, there is no machine in the world that can fit all of YouTube videos but there is no reason why we can't have YouTube, with a limited set of non-production data, running from just one box. Thoughts?

I'm not sure what you mean exactly, but if you're streaming YouTube's traffic through one box (even if that box isn't directly connected to the disks on which the video is stored) you'll run into I/O bottlenecks--such a machine would need to push terrabytes per second which is probably not trivial. Moreover, having a single machine that can handle YouTube's peak traffic probably means you're underutilizing it most of the time.

Re:SQL: 2023 Has Been Released by pooper on Saturday June 03, 2023 @07:32AM (#36175763)
Sorry I should have been clearer. I didn't mean to replace production. I meant like somewhere I can change maybe a few lines of code and run the entire application end to end.

Basically, somewhere I can run something and feel safe knowing this is production code except this one change I have made.

Re:SQL: 2023 Has Been Released by jupp0r on Friday June 02, 2023 @04:38PM (#36170465)
You have a misconception about the workload of your typical database server. It's not about the amount of data it's storing, it's about

1. compute and memory bandwidth to serve complicated queries 2. IO

You can't scale memory bandwidth beyond some pretty low limit on one machine. You can't scale IO bandwidth beyond some limit. To give you an example, I've seen database servers with 20GB of data being so overloaded by compute requirements of complex queries that they needed to be scaled horizontally.

Re:SQL: 2023 Has Been Released by pooper on Saturday June 03, 2023 @07:35AM (#36175774)
But like this server has two 96 core processors. Moreover, we are talking about development environment for a single developer and maybe one or two users to try out their changes. It should be good enough, no?

I mean I expect things to be slower I guess but to test for correctness and spec?

Re:SQL: 2023 Has Been Released by jupp0r on Thursday June 01, 2023 @07:54PM (#36159073)
> I'm not actually sure what bottleneck would motivate you need to scale beyond this configuration

It's usually not that data doesn't fit on one machine but that load on the database exceeds what one machine can serve. A failover configuration might enable you to use the spares for some read operations and take a little load of the primary, but you lose ACID semantics when you do that and it generally doesn't help you for long.

Re:SQL: 2023 Has Been Released by justinclift on Friday June 02, 2023 @01:25AM (#36161351)
Interestingly, when a place does get to the point where the single instance has capacity issues (after upgrading to EPYC and lots of flash drives) then other non-obvious stuff shows up too.

For example, at one place just over a year ago they were well into this territory. One of weird problems for them was with pgBadger's memory usage (https://github.com/darold/pgbadger). That's written in perl, which doesn't seem to do garbage collection well. So even on a reporting node with a few hundred GB's of ram, it could take more than 24 hours to do a "monthly" reporting run to analyse PG usage for the time period.

There wasn't a solution in place at the time I left, so they're probably still having the issue... ;)

Re:SQL: 2023 Has Been Released by threeseed on Thursday June 01, 2023 @04:28PM (#36156911)
I consult for a lot of companies and I never heard of or seen a database that wasn't horizontally scaled.

It's not for scalability reasons it's for high-availability.

Which as cloud adoption has increased and server uptime has decreased is even more important.

Re:SQL: 2023 Has Been Released by jahewson on Thursday June 01, 2023 @05:00PM (#36157255)
Why shard when you can just replicate?
Re:SQL: 2023 Has Been Released by lmm on Thursday June 01, 2023 @05:37PM (#36157707)
Because replica failover is rarely seamless (and often doesn't actually work at all, IME).
Re:SQL: 2023 Has Been Released by mikepurvis on Thursday June 01, 2023 @06:34PM (#36158357)
Instinctively that's surprising... replica failover should be far simpler technically, shouldn't it?
Re:SQL: 2023 Has Been Released by lmm on Thursday June 01, 2023 @07:00PM (#36158615)
No? Replication tends to be a bodged-on mess throughout, full of undertested edge cases, of which failover is definitely one. If you build the system so that nodes joining and leaving is a natural and normal part of operation, well, it naturally works a lot better.
Re:SQL: 2023 Has Been Released by Spooky23 on Thursday June 01, 2023 @05:11PM (#36157393)
Some of these arguments and “common knowledge” things are getting old. Everybody scaled up twenty year ago - hell Amazon used to brag that they used an HP Superdome or whatever.

Anyone with dogmatic opinions about this stuff need to be taken with a grain of salt. If you scale out PeopleSoft, your accounting system will exceed the value of your company. If you’re worried about webscaling your random app, that’s more wasting time navel gazing than accomplishing anything! :)

Re:SQL: 2023 Has Been Released by WorldMaker on Thursday June 01, 2023 @03:57PM (#36156530)
The PGQ part of SQL is designed in such a way that an RDBMS can certainly optimize its storage of graph tables (eventually). ("Graph tables" used by PGQ have DDL setup, per the Eisentraut overview: CREATE PROPERTY GRAPH graphname…) If Postgres embraces PGQ it would be easy to imagine they would also adopt some graph database style storage to back its indexing and query planners.
Re:SQL: 2023 Has Been Released by zozbot234 on Thursday June 01, 2023 @04:12PM (#36156717)
> There's nothing in Postgres that knows how to do that

Postgres uses foreign data wrappers and table partitions to achieve sharding of relational databases over many nodes. It's certainly possible to make the FDW layer smarter wrt. being able to distribute certain queries to the shards, including some recursive queries.

Re:SQL: 2023 Has Been Released by dathinab on Thursday June 01, 2023 @05:05PM (#36157315)
if you are Facebook scale, yes. But then you anyway will use a dedicated graph database.

But a lot of graph databases have sizes where they are fully replicated on each node and some small internal optimizations for the graph are good enough. Given the design of the graph query language (and what you can query, hint: not everything arbitrarily) there is no reason postgres can't gain some additional optimizations to do that effectively as long as it's not facebook scale.

SQL now having syntax for querying graph means Graph databases can support SQL, at least a subset of it, in a standardized way.