Skip to content

Instantly share code, notes, and snippets.

@digitalist
Created January 8, 2020 15:04
Show Gist options
  • Save digitalist/385dab7a394009679641af1cb0a1a706 to your computer and use it in GitHub Desktop.
Save digitalist/385dab7a394009679641af1cb0a1a706 to your computer and use it in GitHub Desktop.
sentry postgres cleanup
apt update
apt install -y pgxnclient
pgxn install pg_repack
#You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
apt install -y postgresql-server-dev-9.5
apt install -y ca-certificates
apt install -y build-essential
apt install -y libssl-dev
pgxn install pg_repack
psql -c "CREATE EXTENSION pg_repack" -d postgres -Upostgres
truncate sentry_activity,sentry_groupbookmark,sentry_message,sentry_groupmeta,sentry_groupedmessage,sentry_messagefiltervalue,sentry_eventuser,sentry_eventtag,sentry_eventmapping,sentry_filtervalue,nodestore_node CASCADE;
NOTICE: truncate cascades to table "sentry_groupseen"
NOTICE: truncate cascades to table "sentry_grouprulestatus"
NOTICE: truncate cascades to table "sentry_groupasignee"
NOTICE: truncate cascades to table "sentry_grouphash"
NOTICE: truncate cascades to table "sentry_userreport"
NOTICE: truncate cascades to table "sentry_groupemailthread"
NOTICE: truncate cascades to table "sentry_groupsnooze"
NOTICE: truncate cascades to table "sentry_groupresolution"
NOTICE: truncate cascades to table "sentry_groupsubscription
....
#done
pg_repack -Upostgres postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment