Updating the Data
Explore how to perform batch updates in PostgreSQL by loading new data files into tables, using SQL join operations for precise updates and inserts, and managing concurrency issues. This lesson provides practical SQL examples and explains assumptions about primary keys for safe data management.
We'll cover the following...
After having loaded the data from May, let’s say that we’ve received an update for June. As usual, with updates of this kind, we don’t have a diff; rather, we have a whole new file with new content.
A batch update operation is typically implemented in this way:
-
Load the new version of the data from the file to a PostgreSQL table or a temporary table.
-
Use the
updatecommand ability to use join operations to update existing data with the new values. -
Use the
insertcommand ...