Today, the only feasible solution is not to create more than 64 subtransactions (savepoints or PL/pgSQL EXCEPTION clauses) per transaction.
pgsql-performance by date:
Соглашаюсь с условиями обработки персональных данных