gpt4 book ai didi

sql - 删除行后留下FILESTREAM文件

转载 作者:行者123 更新时间:2023-12-03 12:06:27 24 4
gpt4 key购买 nike

我已经在SQL 2008服务器上成功设置了FILESTREAM;但是我注意到,即使删除了包含FILESTREAM数据的行,物理数据文件似乎也没有被删除。

物理文件是指SQLServer托管目录中的文件,其文件名带有uniqueidentifer,而不是添加到dbase的原始文件。

有谁知道SQLServer是否最终将删除该文件?如果从dbase中删除了很多大文件,我希望能够快速回收空间。

最佳答案

FILESTREAM数据受事务控制,因此不会立即删除。

相反,SQL Server运行一个垃圾回收器,当确定已最终删除旧数据时,它将清除旧数据。

documentation:

FILESTREAM garbage collection is a background task that is triggered by the database checkpoint process. A checkpoint is automatically run when enough transaction log has been generated. For more information, see the SQL Server 2008 Books Online topic “CHECKPOINT and the Active Portion of the Log” (http://msdn.microsoft.com/en-us/library/ms189573.aspx). Given that FILESTREAM file operations are minimally logged in the database’s transaction log, it may take a while before the number of transaction log records generated triggers a checkpoint process and garbage collection occurs. If this becomes a problem, you can force garbage collection by using the CHECKPOINTstatement.

关于sql - 删除行后留下FILESTREAM文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1625001/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com