I am building a DB solution to handle a fast stream of online events.
Each event UPSERTs a row in a location_update
table, using its car_id
primary key. Since there are very few new car_id
s, the vast majority of events trigger an UPDATE.
Since the table very frequently read by SELECT statements, I would like to minimize any locking and blocking delays on the table, and especially prevent a single UPDATE from blocking a large number of SELECTs.
How do I minimize Read/Write locking time on a table being UPDATEd using a primary key?
UPDATE
s run?INSERT ... ON CONFLICT DO NOTHING/UPDATE
("UPSERT")