Home > database >  The discussion about data logic delete mode
The discussion about data logic delete mode

Time:09-26

For data deletion in general there are a lot of use add a delflag database table to table is deleted, so that operations will no doubt have drawbacks, however, is that every time to find the words to use in conditions delfllag, which makes the development up to this on the one hand, give attention to two or morethings and large amount of data will undoubtedly reduce the efficiency of data query,
Also has a design pattern is in addition to create a new table to store the deleted information, for example, we can establish a trigger or write a stored procedure, but in this way, this can also be designed as an audit log table structure, so to log records system operation can be detected and some mistaken delete data can be responsible to the people, but I heard that also has drawbacks, so if you remove data will have a large database to pieces, I do not know whether there are other disadvantages?

I don't know what a great god introduced download what circumstances use which kinds of design patterns or there is a better design?

CodePudding user response:

Delete mode is based on demand and application,
Different applications and requirements, delete differently,

Common deletion policy are:
1. Partition deleted
2. Insert the history table, truncate table
3. Make a particular operation, triggered delete
4. Other ways to delete
. Wait a minute!

CodePudding user response:

Since deleted, still have? Since check, then modify the sign bit can ah, feel afraid of data query, the influence of a list for you save these data not only has the problem, there are more problems: even with the original table put together, also can partition, and a list if on the other, whether procedures to complete or trigger to complete, are extra overhead,

CodePudding user response:

If the data is the data dictionary, it is recommended that the left, and use delflag tags deleted, is useful for historical data query,

If you want to delete the data itself is a big table, suggest to move to the history table, or do the table partitioning,

CodePudding user response:

Big table or suggest a partitioned table or history list processing
  • Related