[–] hans_castorp 4 days ago
[–] mike_hearn 4 days ago
Compare Postgres and Oracle (block undo based) for what happens when the database is underprovisioned:
• Postgres: bottlenecks on CPU. The database falls behind on vacuuming and dies.
• Oracle: bottlenecks on free disk space. Individual long running statements, SNAPSHOT and READ ONLY transactions get cancelled with a "snapshot too old" error.
In Oracle the database continues running and the blast radius is limited to a single statement. Because it's the longest running statements that die first, that almost certainly means an asynchronous business report and not live user traffic - which is exactly what you'd hope for. Most businesses can tolerate a missing day in a report much better than customer-facing outages, and fixing it is just a single SQL statement if you have free disk space (adding more storage is easy due to the SAN).
That's much preferable! How many post mortems do we see on HN from some startup bemoaning a multi-hour outage caused by Postgres' MVCC choices? Quite a lot. Now think about how often do you recall reading a post mortem of an outage at some big bank, hospital, shipping port etc that traces back to Oracle's MVCC engine? I don't think I ever read one. The startup world likes to make fun of Big Enterprise, but they have a much better track record of database uptime because they stay away from vacuum-based MVCC.
Disclosure: I have a part time role in the Oracle DB group. Unapproved opinions may be found above, caveat emptor.
[–] senderista 3 days ago
[–] xyzzy_plugh 3 days ago
[–] senderista 3 days ago
[–] mike_hearn 3 days ago
The simplest form of Flashback just uses the undo logs. Normally undo is deleted once no live transaction uses it, but you can set a retention time to allow SELECT ... AS OF ... queries to go back at least that far.
However, keeping undo logs around forever isn't practical. If you want to go back a year then there's Flashback Time Travel which copies old data into tables in a form that the query engine can use to answer AS OF queries more efficiently.
[–] senderista 2 days ago
I don’t know if Flashback uses this technique, but the SQL Server architect who taught me time-split B-trees now works at Oracle :)
[–] xyzzy_plugh 3 days ago
[–] matharmin 4 days ago
[–] guenthert 4 days ago
[–] akoboldfrying 4 days ago
> That's the honest shape of the mitigation: HOT is opportunistic, arrives in steady state rather than on demand, and quietly costs you 30% of your table size in reserved space.
[–] senderista 3 days ago
[–] jon128 4 days ago
OrioleDB is friendlier to SSDs and is de facto "the other" MVCC of Postgres. OrioleDB may be still be "beta" but that hasn't stopped operators/users.
MariaDB has some alternative MVCC, one of them is particularly outstanding.
SSD endurance at scale has on and off been a major concern for me, so I empathize with that. Others deserve to know of OrioleDB, and Postgres more broadly is probably better off for it too.
https://www.uber.com/us/en/blog/postgres-to-mysql-migration/[–] hans_castorp 4 days ago
[–] jon128 3 days ago
What Uber posted there did prompt me to investigate the topic of Postgres old MVCC, OrioleDB, and MariaDB's alternative MVCC.
Ultimately, one change in a row results in the entire row being written again, from what I read. Is this not accurate?
MariaDB's MVCC doesn't write the entire row again, only the delta. One of the newer more advanced MVCC for MariaDB are even more efficient.
In my view, "runaway vacuum" has never not been a case of either poorly done IT operations or poorly thought out (or just not thought out) database usage patterns by the in-house application developers. While "throw hardware at the problem" isn't a great answer, I have never not seen NVDIMM for ZFS ZiL/SLOG not mitigate "runaway vacuum", as ugly as that is -- that was a long time ago though.
SSD endurance can get daunting in an advanced hosting environment. It's odd that I don't often see others have these metrics in their Prometheus+Grafana. The people who are telling me that OrioleDB alleviates their endurance concerns aren't at liberty to show me their Grafana.
I might be able to get some real SSD endurance metrics comparisons at meaningful scale over the next couple years but I don't know.
Beyond that, I think the only real way to find out is a snapshot of real-world application production Postgres databases and use logical replication to replay a year of database traffic to find out what the delta on SSD endurance impact is.
I don't claim to be a Postgres expert relative to the upper echelon that frequents this site, always happy to get more insight to Postgres, my attention has generally been on either North or South side of that part of a webscale stack.
This article about MVCC is also quite interesting: https://boringsql.com/posts/mvcc-bad-bad/