The note that savepoints in postgresql don’t perform well is news to me. They are used extensively in different applications. Even in plpgsql, any time you catch an exception, it’s using savepoints under the hood. Perhaps there is room for more optimization there.