The best way to endorse a table by periods [closed]

0

I have a table ( tabla_1 ) that is constantly edited with certain values and I want to be able to keep a searchable record of these same data of their state in periods of time gone by.

I am considering creating a second table ( tabla_periodos ) and saving the hundreds of users with an additional field that corresponds to the period as an identifier.

Something like:

{tabla_periodos}
juan,  activo,   [email protected],  periodo1 
pedro, inactivo, [email protected], periodo1
juan,  inactivo, [email protected],  periodo2 
pedro, inactivo, [email protected], periodo2

But I feel I would be saturating the table and I think there may be better ways to have a record in my base, any suggestions that can give me those who have more experience in this topic?

    
asked by claus 07.07.2018 в 00:31
source

1 answer

1

It is a good idea to create a new table and to be fed by means of a trigger when inserting and updating the main table, taking into account the join.

Do not worry about the amount of data, instead analyze how to optimize it. In addition, the fact that it is stored does not imply much, but the consultation and manipulation of this data.

It should also be taken into account how often the table will be purged, or deleting data from a certain period backwards, for example, that the system automatically deletes data less than one or two years.

In the trigger save only the modified data in json. If you need help with the trigger, let me know.

    
answered by 07.07.2018 / 05:20
source