Bulk/batch update/upsert in PostgreSQL

前端 未结 5 1412
慢半拍i
慢半拍i 2020-11-29 00:27

I\'m writing a Django-ORM enchancement that attempts to cache models and postpone model saving until the end of the transaction. It\'s all almost done, however I came across

5条回答
  •  佛祖请我去吃肉
    2020-11-29 01:08

    Turn off autocommit and just do one commit at the end. In plain SQL, this means issuing BEGIN at the start and COMMIT at the end. You would need to create a function in order to do an actual upsert.

提交回复
热议问题