Before you save the data from an application, you should reflect on which data needs to be stored. In most cases, you don't need to save all the data you've read. Some actions can be executed to identify whether it's an insertion, an update, or a deletion of data.
Let's have a short look on the different meanings of these terms:
- INSERT: A new database table entry is created
- UPDATE: Existing data is changed
- DELETE: Existing data is deleted from the database table
In the case of implementing any logic for reading and maintaining data, you should follow the performance rules from the beginning. As a best practice, you can compare the data changed by the application with the unchanged data read in the beginning of your logical unit of work (LUW).
For this, you can hold a copy of the original data within a data object that...