Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database Size on SQL Server too big #116

Open
luizfbicalho opened this issue Dec 7, 2021 · 0 comments
Open

Database Size on SQL Server too big #116

luizfbicalho opened this issue Dec 7, 2021 · 0 comments

Comments

@luizfbicalho
Copy link

luizfbicalho commented Dec 7, 2021

This bug is copied from HangfireIO/Hangfire#1976

asked this question on stack overflow

https://stackoverflow.com/questions/70177605/how-can-i-clean-hangfire-sql-database-keeping-the-actual-jobs-running

My databases are too big for not that many active jobs, I looked at the database and in the Set and Hash Tables there are information that aren't linked to any active job, I mean, old suceeded jobs are deleted but their information on the Set and Hash tables aren't cleaned

What can I do to clean this records? shoudn't all of these tables have FKs to the Job table and delete cascade on it?

This Is my production size at the moment

image

I have the extensions

Hanfire.Console 1.4.2 and Hangfire.Recurringjobextenions 1.1.6

ths is the set table

image

select substring([key],0,9),count(*) from [HangFire].[Set] group by substring([key],0,9) order by 2 desc

State is also very big, I have some old jobs that run, try to do something and schedule again for some time in the future, is there a way to clean the old state from a job, I mean, I could keep just the essencial from the previous months

this is the hash table

image

select  substring([key],0,13),count(*),field  from [HangFire].Hash

group by substring([key],0,13),field
order by 1 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant