Issue: A few days ago, our database storage usage increased by 3GB within a few hours. Upon reviewing System Insights, we noticed a spike in Temporary Files associated with a specific table. We managed to reduce the Temporary Files by disabling Point-in-Time Recovery (PITR), but this did not impact the overall Storage Usage. Some users on StackOverflow suggested restarting the SQL instance to address Storage Usage, but we have not attempted this, as we are unsure how long the instance restart would take.
What We’ve Tried:
Disabled Point-in-Time Recovery
What We’ve Achieved:
Reduction in Temporary Files
Goal:
Reduction in Storage Usage
Questions:
Will the Temporary Files be automatically deleted after 7 days following the disabling of Point-in-Time Recovery?
Is there a way to manually delete the Temporary Files?
Will restarting the SQL instance remove the Temporary Files?
No. PITR affects binary logs, not temporary files. Temporary files are managed separately and won’t be automatically deleted after disabling PITR.
No. Temporary files are managed internally by the database engine and cannot be manually deleted. They may clear automatically after query completion or an instance restart.
Yes, likely. Restarting the instance usually clears temporary files. However, storage space reclamation may not be immediate, and downtime (5–15 minutes) should be expected.
Here are some recommendations:
Restart the Instance: Schedule a restart during maintenance to clear temporary files and reclaim storage.
Optimize Queries: Identify and fix queries causing excessive temporary file usage (e.g., large ORDER BY, GROUP BY, joins).
Increase Storage: If necessary, add storage or enable automatic storage increases to prevent outages.
Monitor & Seek Support: Use query insights to track issues, and contact Google Cloud Support for persistent problems.