3 ms·
im not a postgres guy so I don't know how possible this is - couldn't the pythonic "forgiveness not permission" pattern work here? That is, a proc that just at
by Pxtl 13y ago
im not a postgres guy so I don't know how possible this is - couldn't the pythonic "forgiveness not permission" pattern work here?
That is, a proc that just attempts the insert, handles the unique or primary key constraint violation error, and then proceeds to the update as a fallback? Sure you push the concurrency risk to deletion instead of creation, but deletions are generally more rare than creations so a table-lock on deletion is more palatable.
- amirouche 13y agoposgres is implementing both permission and forgiveness for performance reasons.
- amirouche 13y agoWhat is troubling for me, is to have a database that works sometime and is sometime fast. But no database that works all the time and is /slow/.
- spacemanmatt 13y agoThis is a common trouble. It is, however, a structural artifact of data size. You cannot solve this problem with a "code" solution because it is an actual computational complexity issue, not a implementation weakness. This is why data design is with performance and security as an attribute that you must bake in. You cannot bolt on data design after the fact.