What are the pros and cons of having history tables?

WHAT is the best practice ?:

  • Save history records in a separate history table

  • Save history records in active table with different status?

In my opinion, I prefer to keep a separate table in order to avoid creating one huge table with duplicate records, which can cause unwanted delay time when querying the table.

+3
source share
4 answers

, , "WHERE Status =" LIVE "" WHERE CurrentRecord = 1 " ( , , (), ). , , .. , ad-hoc , .

, , , /db, - /db ..

+2

Pro:
, , - . , . , .
Con:
, , 350 ( , .....). , , . "" "". (), , - ...

, , , .

+1

I prefer to use one table and partioning. I also set the view for active records and would use this instead of the base table when querying active records.

+1
source

I would go for a separate table, otherwise configuring UNIQUE and FK constraints might still be feasible, but too involved.

0
source

Source: https://habr.com/ru/post/1768257/


All Articles