Skip to content

Instantly share code, notes, and snippets.

@lesovsky
lesovsky / postrgesql-autovacuum-queue-detailed.sql
Created April 10, 2017 08:39
postrgesql-autovacuum-queue-detailed
WITH table_opts AS (
SELECT
c.oid, c.relname, c.relfrozenxid, c.relminmxid, n.nspname, array_to_string(c.reloptions, '') AS relopts
FROM pg_class c
INNER JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE c.relkind IN ('r', 't') AND n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_temp'
),
vacuum_settings AS (
SELECT
oid, relname, nspname, relfrozenxid, relminmxid,
@ceilfors
ceilfors / cleanupUnusedWorkspaceInSlaves.groovy
Last active September 14, 2023 20:30
When you delete jobs in Jenkins, the corresponding workspaces in the build slaves won't be deleted automatically. This Jenkins script will go to each slave and check if the jobs are already deleted in Jenkins master and delete the workspace.
import com.cloudbees.hudson.plugins.folder.Folder
import hudson.FilePath
import jenkins.model.Jenkins
def boolean isFolder(String name) {
def item = Jenkins.instance.getItemByFullName(name)
return item instanceof Folder
}
def deleteUnusedWorkspace(FilePath root, String path) {