Re:Show HN: My experimental take on a decentralized ledger
by buhrmi on Wednesday September 16, 2015 @06:48AM
(#10225723)
I'm using upserts... The reason I'm using upserts is basically just lazyness because I didn't feel like refactoring the source code to work around requiring upserts. Also, I'm not very confident in C++ so I did not want to take on that task.
Re:Show HN: My experimental take on a decentralized ledger
by opendomain on Wednesday September 16, 2015 @09:36AM
(#10226422)
You can fix this with basic SQL
IF record EXISTS then UPDATE else INSERT
Re:Show HN: My experimental take on a decentralized ledger
by anarazel on Wednesday September 16, 2015 @10:45AM
(#10226963)
No. Conccurrency makes it way harder than that.
Re:Show HN: My experimental take on a decentralized ledger
by devit on Wednesday September 16, 2015 @01:10PM
(#10228157)
In PostgreSQL, you can set the SERIALIZABLE isolation level for the whole database, put a retry loop around all database transactions and completely stop worrying about concurrency issues.
I think all database applications should be written like this at least until performance starts being an issue.
Re:Show HN: My experimental take on a decentralized ledger
by anarazel on Wednesday September 16, 2015 @06:38PM
(#10230453)
Entirely depends on the the type of workload / application architecture. In some cases the rollback ratios will be massive (I've seen 70%). In other cases adding such a retry loop is unattractive because the latency jitter. Or retaining all involved data for a retry is unattrictive.
Yet Another problem is that you need to enforce all sessions potentially involved in a data race need to use serializable; that can be easy or hard, depending on the scenario.
Which PostgreSQL features new in 9.5 are being used that cause that? Or are earlier versions somehow buggy?