-
Notifications
You must be signed in to change notification settings - Fork 7
Add functionality for old jobs removal #60
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| SELECT system_job_id | ||
| FROM jobs | ||
| WHERE updated_at < $1 | ||
| ORDER BY updated_at desc | ||
| LIMIT 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| DELETE FROM job_cluster_tags | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. once we have the cutoff system_job_id... all these queries will become much simpler: PS the same comment on all other queries.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately we are not in the MySQL world :( Postgre doesn't support that WITH delete_batch AS (
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh... this is sad :) CTE way looks a bit more readable than the subquery though :) |
||
| WHERE system_job_id IN ( | ||
| SELECT system_job_id | ||
| FROM job_cluster_tags | ||
| WHERE system_job_id <= $1 | ||
| LIMIT 100 | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
|
|
||
| DELETE FROM job_command_tags | ||
| WHERE system_job_id IN ( | ||
| SELECT system_job_id | ||
| FROM job_command_tags | ||
| WHERE system_job_id <= $1 | ||
| LIMIT 100 | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
|
|
||
| DELETE FROM jobs | ||
| WHERE system_job_id IN ( | ||
| SELECT system_job_id | ||
| FROM jobs | ||
| WHERE system_job_id <= $1 | ||
| LIMIT 100 | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| DELETE FROM job_tags | ||
| WHERE system_job_id IN ( | ||
| SELECT system_job_id | ||
| FROM job_tags | ||
| WHERE system_job_id <= $1 | ||
| LIMIT 100 | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if j.FinishedJobRetentionDays <= 0