News for hackers. Stuff that matters.
Re:How Postgres Makes Transactions Atomic by sgt on Wednesday August 16, 2017 @02:07PM (#15029699)
Postgres is entirely designed around the idea of durability, which dictates that even in extreme events like a crash or power loss, committed transactions should stay committed.

Although if I had a $100 for every time I've had DB corruption in Postgres over the years...

That being said, since 9.4 (or maybe 9.5) these incidents have mostly stopped happening and it's been remarkably stable.

Re:How Postgres Makes Transactions Atomic by orthecreedence on Wednesday August 16, 2017 @02:12PM (#15029749)
Hi, very curious under what situations you had data corruption. I use postgres a lot and haven't experienced (or noticed) this. I'm wondering if I'm using it differently than you or if I've been lucky =]
Re:How Postgres Makes Transactions Atomic by sgt on Wednesday August 16, 2017 @02:37PM (#15029977)
Most of our cases have been standby servers having corrupted WAL files, to be discovered only when the master has had a physical disk crash or similar.

After a few tough lessons like that we've put monitoring in place for ensuring that the standby and/or PITR servers have testing in place e.g. PITR servers must have uninterrupted WAL sequences.

Most Postgres corruption (on a master) actually happens due to dodgy hardware, but we don't really use bad hardware. In cases where we used VM's we've suspected something fishy in VMWare itself. In one case we suspected the SAN that the VMWare host was using.

So mostly not Postgres' fault. There were however some known replication bugs in the 9.x versions that were quite nasty. I think those bugs have now all or mostly been fixed, so 9.6 and 10 (beta) onwards are extremely stable.

But the risk of HW issues still remain as the biggest reason for postgres corruption.

I cannot emphasize enough how important backups are (both standby servers and PITR) and also to verify that these are indeed valid for that day when you're going to need to use them.

Re:How Postgres Makes Transactions Atomic by orthecreedence on Wednesday August 16, 2017 @02:41PM (#15030006)
Great response, thank you. Seems mostly replication-related, which admittedly I haven't delved into much. I've used postgres to hold a lot of data, but haven't gotten to the point where it needed to scale out yet. This is great to know for when that starts to be a concern. I'll definitely heed your advice on backups (already do them, but could put more automation into verifying they work).
Re:How Postgres Makes Transactions Atomic by Manozco on Wednesday August 16, 2017 @03:15PM (#15030292)
You would probably be less rich than if you had 1$ each time MongoDB loses data :P /s
Re:How Postgres Makes Transactions Atomic by gnaritas on Wednesday August 16, 2017 @02:30PM (#15029909)
> Although if I had a $100 for every time I've had DB corruption in Postgres over the years...

You'd be broke. :)

Re:How Postgres Makes Transactions Atomic by random_comment on Wednesday August 16, 2017 @04:44PM (#15031220)
That probably depends on a bunch of stuff.

- PG only added checksums in 9.3

- his disks or RAID controller could be shit or he could be using some 'very cool' filesystem

- Some people turn off PG settings for performance that really shouldn't be turned off

- Some people think ECC ram isn't worth the money

- or overclock their CPU on anything other than a gaming machine

Usually it's shit hardware

https://wiki.postgresql.org/wiki/Corruption