It is much easier to store each entire record than to store them. Then, if you want a spread of the two versions, you can generate them as needed using the PECL Text_Diff library .
I like to store all versions of a record in a single table and retrieve the last of them using MAX(revision) , the "current" logical attribute, or similar. Others prefer to denormalize and have a mirror table that contains inaccurate versions.
If you save diff instead, your circuitry and algorithms become much more complex. Then you need to save at least one “full” revision and several versions of “diff”, and also restore the full version from the set of differences whenever you need the full version. (This is how SVN stores things. Git stores a complete copy of each revision, not diff.)
Programmer time is expensive, but disk space is usually cheap. Please consider whether the problem of saving each revision is really a problem.
source share