简体   繁体   English

数据库中正确的垃圾回收机制是什么?

[英]What would be the proper garbage collection mechanism in a DB?

I store some data in DB for my future usage. 我将一些数据存储在DB中以备将来使用。 After using those data, i would like to remove those data from database. 使用这些数据后,我想从数据库中删除那些数据。 What would be the effective way to do this? 有效的方法是什么? I need to select data and clean them in an efficient manner. 我需要选择数据并以有效的方式清理它们。 Im using java as my language and MySql as my storage DB. 我使用Java作为语言,使用MySql作为存储数据库。

Any ideas would be appreciated.. 任何想法,将不胜感激..

If the data is only going to be used once, then it can be deleted. 如果数据仅要使用一次,则可以将其删除。 If all data in the table can be deleted then the most efficient means would be to either drop the table or to truncate it. 如果可以删除表中的所有数据,那么最有效的方法是删除表或截断它。 If neither of these are possible then deletion by PK would be the next best method. 如果这些都不可行,则通过PK删除将是下一个最佳方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM