How to efficiently update postgres using a tuple of the PK and a value?
问题 My SCHEMA is the following and I have ~ 4m existing posts in the DB that I need to update. I am adding an integer which points to a text location. CREATE TABLE app_post ( id integer NOT NULL, text_location integer, title character varying(140) ); I want to update existing records with a long (1000-5000) list of tuples that represent (id, text_location): [(1, 123), (2,3), (9, 10)....] What is the most efficient way to do this? 回答1: If you are generating the values on the fly using phyton, you