authz: remove upsert for updating user pending permissions
Created by: unknwon
We used to rely on ON CONFLICT ON CONSTRAINT
to do upsert when we do batch update on user_pending_permissions
table. However, there are reasons why the approach in this PR is better (use update not upsert):
- The primary key (
id
) ofuser_pending_permissions
table is increased rapidly every time hitsON CONFLICT ON CONSTRAINT
for no obvious benefit. (Have seen a customer with few thousand rows butMAX(id)
>80,000,000). - At the moment of "upsert", we already have
id
s on hand, could have just used it to directly update rows with theseid
s as they are primary keys.
This PR does not solve 1. entirely but at least slows down id
increment pace by half. Another half is caused by: