Is there a way to limit what's stored in SQL History?
Bev
Posts: 6 New member
in SQL Prompt
SQL History takes too long to open and freezes SSMS while its doing so, probably due to the size of the db. It also takes forever to search for anything when you get it open. I appreciate the versioning saves but is there a way to limit this? I don't need to save all 15 different changes to a query while I was experimenting with code, and I really don't need things from a year ago. Is there a way to reduce the number of versions saved, and maybe clear out things older than x amount of weeks/months etc?
Tagged:
Answers
Hi @Bev
Thank you for reaching out on the Redgate forums regarding your SQL Prompt > History inquiry.
There are some settings that can be tweaked around this, but at present it is limited.
In the SQL Prompt settings section, there is a limit that can be placed on the individual query size. Reducing this can help with the side of the dB.
There is an automated process that runs behind the scene after 7 days some snapshots are removed (query edited and connection changed) and then VACUUM is run on the SqlHistory.db file which rebuilds the database file, repacking it into a minimal amount of disk space.
I have searched through our UserVoice feature request page and found some existing requests that look to align with the type of settings you're requesting.
It would be a good suggestion to look at these links and upvote any ideas that would be useful for your requirements. Providing comments on how it impacts your usage of SQL Prompt & History are welcomed and ensure appropriate visibility for our development team to implement into future releases
https://redgate.uservoice.com/forums/94413-sql-prompt/suggestions/46236559-sql-history
https://redgate.uservoice.com/forums/94413-sql-prompt/suggestions/46279948-sql-history