09:25:50.777 [info] Pruning objects older than 90 days, keeping non public posts, keeping threads intact, pruning orphaned activitiesRunning the forbidden task ;)
pleroma-pruned-db-winning.png
Signal feed
Post
Remote status
Context
2309:25:50.777 [info] Pruning objects older than 90 days, keeping non public posts, keeping threads intact, pruning orphaned activitiesRunning the forbidden task ;)
#!/bin/bash
to_delete=$1
batch_size=$2
do_delete () {
n=$1
out=$(psql -U pleroma -d pleroma -p 5435 -c "delete from activities where id in (select id from activities a where a.inserted_at < '2026-01-01'::date and not local and split_part('data->>object', '/', 3) != 'decayable.ink' limit $n)")
echo $out
}
i=$to_delete
while [[ $i -gt 0 ]]; do
a=$(do_delete $batch_size);
i=$((i-$batch_size))
deleted=$(($to_delete - $i))
pct=$(($deleted * 100 / $to_delete))
echo $(date --iso-8601="seconds") $pct $a
done
you probably need to adjust how psql is called, and obviously the date and the domain. The query is a little ugly in there but here it is formatted a little better:
delete from activities where id in (
select id from activities a
where
a.inserted_at < '2026-01-01'::date
and not local
and split_part(data->>'object', '/', 3) != 'decayable.ink'
limit 10000
)
The compound select is necessary to do this in batches, which keeps postgres flushing the deletes constantly instead of aggregating everything up and do one biiiiiig delete. As a bonus the script eats the output and gives you progress readouts. It's okay to go a little over the total number of rows you want to delete (you can count(*) the inner select in order to get the exact amount).
@pwm @phnt @pernia >it starts with
One thing, I don't know why
It doesn't even matter how hard you try
Keep that in mind, I designed this rhyme to explain in due time
All I know, time is a valuable thing, watch it fly by as the pendulum swings
Watch it count down to the end of the day, the clock ticks life away
It's so unreal, didn't look out below, watch the time go right out the window
Tryna hold on, d-didn't even know, I wasted it all just to watch you go
I kept everything inside, and even though I tried, it all fell apart
What it meant to me will eventually be a memory of a time when
I tried so hard, and got so far
But in the end, it doesn't even matter
I had to fall to lose it all
But in the end, it doesn't even matter
One thing, I don't know why
It doesn't even matter how hard you try
Keep that in mind, I designed this rhyme to remind myself how I tried so hard
In spite of the way you were mockin' me, actin' like I was part of your property
Rememberin' all the times you fought with me
I'm surprised it got so far
Things aren't the way they were before
You wouldn't even recognize me anymore
Not that you knew me back then, but it all comes back to me in the end
You kept everything inside, and even though I tried, it all fell apart
What it meant to me will eventually be a memory of a time when
I tried so hard, and got so far
But in the end, it doesn't even matter
I had to fall to lose it all
But in the end, it doesn't even matter
I've put my trust in you
Pushed as far as I can go
For all this, there's only one thing you should know
I've put my trust in you
Pushed as far as I can go
For all this, there's only one thing you should know
I tried so hard and got so far
But in the end, it doesn't even matter
I had to fall to lose it all
But in the end, it doesn't even matter
Replies
0We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect